diff --git a/splunk_add_on_ucc_framework/global_config_validator.py b/splunk_add_on_ucc_framework/global_config_validator.py index bbbee491f0..45ad621d82 100644 --- a/splunk_add_on_ucc_framework/global_config_validator.py +++ b/splunk_add_on_ucc_framework/global_config_validator.py @@ -21,16 +21,19 @@ import logging import itertools from splunk_add_on_ucc_framework.const import SPLUNK_COMMANDS - -import jsonschema - from splunk_add_on_ucc_framework import dashboard as dashboard_lib from splunk_add_on_ucc_framework import global_config as global_config_lib from splunk_add_on_ucc_framework.tabs import Tab from splunk_add_on_ucc_framework.exceptions import GlobalConfigValidatorException + +from pathlib import Path +from jsonschema import Draft7Validator +from referencing import Registry, Resource + logger = logging.getLogger("ucc_gen") + # The entity types that do not allow to add validators (so the warning will not appear) ENTITY_TYPES_WITHOUT_VALIDATORS = { "radio", @@ -45,8 +48,9 @@ class GlobalConfigValidator: """ - GlobalConfigValidator implements different validation for globalConfig file. - Custom validation should be implemented here. + GlobalConfigValidator validates a global configuration file + against split JSON schemas with relative $refs using a registry. + This implementation keeps all relative $refs as-is. """ def __init__( @@ -55,25 +59,58 @@ def __init__( global_config: global_config_lib.GlobalConfig, source: str = "", ): - self._internal_root_dir = internal_root_dir - self._source_dir = source + self._internal_root_dir = Path(internal_root_dir) + self._schema_dir = self._internal_root_dir / "schema" self._global_config = global_config self._config = global_config.content + self._source_dir = source + self._registry = self._build_registry() self.resolved_configuration = global_config.resolved_configuration + def _build_registry(self) -> Registry: + """ + Load all JSON schema files into a referencing.Registry. + Each schema is registered using its path relative to the schema root directory. + """ + registry = Registry() + for json_path in self._schema_dir.rglob("*.json"): + try: + schema_data = json.loads(json_path.read_text()) + resource = Resource.from_contents(schema_data) + + # Use the path relative to the schema root as the URI + schema_id = str(json_path.relative_to(self._schema_dir)) + + # Register in the registry + registry = registry.with_resource(uri=schema_id, resource=resource) + + except Exception as e: + print(f"Skipping schema {json_path}: {e}") + + return registry + def _validate_config_against_schema(self) -> None: """ - Validates config against JSON schema. - Raises jsonschema.ValidationError if config is not valid. + Validate the configuration against the root schema (schema.json) + using the registry to resolve all relative $refs. """ - schema_path = os.path.join(self._internal_root_dir, "schema", "schema.json") - with open(schema_path, encoding="utf-8") as f_schema: - schema_raw = f_schema.read() - schema = json.loads(schema_raw) - try: - return jsonschema.validate(instance=self._config, schema=schema) - except jsonschema.ValidationError as e: - raise GlobalConfigValidatorException(e.message) + root_schema_path = self._schema_dir / "schema.json" + root_schema = json.loads(root_schema_path.read_text()) + + # Draft7Validator can use the registry directly to resolve $refs + validator = Draft7Validator(root_schema, registry=self._registry) + + errors = sorted(validator.iter_errors(self._config), key=lambda e: e.path) + if errors: + for error in errors: + print( + "Validation error:", + { + "path": list(error.path), + "message": error.message, + }, + ) + raise GlobalConfigValidatorException(error.message) def _validate_configuration_tab_table_has_name_field(self) -> None: """ diff --git a/splunk_add_on_ucc_framework/schema/common/common.json b/splunk_add_on_ucc_framework/schema/common/common.json new file mode 100644 index 0000000000..57eb824c0e --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/common/common.json @@ -0,0 +1,622 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "common/common.json", + "title": "Common Schemas", + "type": "object", + "definitions": { + "Field": { + "type": "string", + "description": "Unique identifier for an input field used in forms and data handling.", + "pattern": "(?!^(?:persistentQueueSize|queueSize|start_by_shell|output_mode|output_field|owner|app|sharing)$)(?:^\\w+$)" + }, + "SubDescription": { + "type": "object", + "description": "Extended description section that provides detailed information about a page or section with optional embedded links.", + "properties": { + "text": { + "type": "string", + "description": "Main description text. Use \\n to add line breaks.", + "maxLength": 1500 + }, + "links": { + "$ref": "#/definitions/links" + } + }, + "required": [ + "text" + ] + }, + "links": { + "type": "array", + "description": "Array of link definitions that can be embedded within description text using placeholder slugs.", + "items": { + "type": "object", + "properties": { + "slug": { + "type": "string", + "description": "Unique identifier used as a placeholder in text. Surround with double square brackets [[slug]] in the text to create the link.", + "maxLength": 50, + "pattern": "^\\w+$", + "minLength": 1 + }, + "linkText": { + "type": "string", + "description": "Display text for the link that replaces the slug placeholder.", + "maxLength": 500, + "minLength": 1 + }, + "link": { + "description": "URL or path destination for the link.", + "type": "string", + "minLength": 1 + } + }, + "required": [ + "slug", + "linkText", + "link" + ] + } + }, + "ValueLabelPair": { + "type": "object", + "description": "Option item with a display label and corresponding value for form controls.", + "properties": { + "value": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string", + "maxLength": 250 + }, + { + "type": "boolean" + } + ], + "description": "The actual value to be stored when this option is selected." + }, + "label": { + "type": "string", + "maxLength": 100, + "description": "Text displayed to the user for this option." + } + }, + "required": [ + "label" + ], + "additionalProperties": false + }, + "help": { + "anyOf": [ + { + "type": "string", + "description": "Help text gives context about a fields input, such as how the input will be used. It is displayed directly below an input field." + }, + { + "$ref": "#/definitions/helpWithLinks" + } + ] + }, + "helpWithLinks": { + "type": "object", + "description": "Property to provide structured help message", + "properties": { + "text": { + "type": "string", + "description": "Text used for the help message, you can put \n to add a breakline." + }, + "links": { + "$ref": "#/definitions/links" + }, + "link": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, + "SaveValidatorHook": { + "type": "object", + "description": "Apply customized validation", + "properties": { + "saveValidator": { + "type": "string", + "maxLength": 3000, + "description": "Allows you to pass a Javascript function as a string to apply customized validation to form data." + } + }, + "additionalProperties": false + }, + "capabilities": { + "type": "object", + "description": "Define capabilities for the users", + "properties": { + "put": { + "type": "string", + "description": "Define capability when PUT method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" + }, + "delete": { + "type": "string", + "description": "Define capability when DELETE method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" + }, + "post": { + "type": "string", + "description": "Define capability when POST method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" + }, + "get": { + "type": "string", + "description": "Define capability when GET method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" + } + }, + "anyOf": [ + { + "required": [ + "put" + ] + }, + { + "required": [ + "delete" + ] + }, + { + "required": [ + "post" + ] + }, + { + "required": [ + "get" + ] + } + ], + "additionalProperties": false + }, + "CustomComponent": { + "type": "object", + "properties": { + "type": { + "const": "external", + "type": "string", + "description": "Exactly: external" + }, + "src": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "src" + ] + }, + "Hook": { + "description": "It is used to add custom behaviour to forms. Visit the Custom Hook page to learn more.", + "$ref": "#/definitions/CustomComponent" + }, + "CustomRow": { + "description": "Used to customise the moreInfo Component.", + "$ref": "#/definitions/CustomComponent" + }, + "CustomCell": { + "description": "Used to modify the default cell values.", + "$ref": "#/definitions/CustomComponent" + }, + "WarningMessage": { + "type": "object", + "description": "It is used to add the custom warning message for each of the modes of ‘create’, ‘edit’, ‘config’, and ‘clone’. The message is displayed on the form.", + "properties": { + "create": { + "$ref": "#/definitions/WarningMessageObject" + }, + "edit": { + "$ref": "#/definitions/WarningMessageObject" + }, + "clone": { + "$ref": "#/definitions/WarningMessageObject" + }, + "config": { + "$ref": "#/definitions/WarningMessageObject" + } + }, + "additionalProperties": false + }, + "WarningMessageObject": { + "type": "object", + "description": "Object for individual warning messages displayed in forms.", + "properties": { + "message": { + "type": "string", + "description": "Text content of the warning message. Use \\n to add line breaks.", + "maxLength": 500 + }, + "alwaysDisplay": { + "type": "boolean", + "default": false, + "description": "When true, the message remains visible even after user input changes. When false, the message disappears after any input modification." + } + }, + "required": [ + "message" + ] + }, + "HideForPlatform": { + "description": "Defines for which platform element should be hidden from UI perspective.", + "anyOf": [ + { + "const": "cloud" + }, + { + "const": "enterprise" + } + ] + }, + "delimiter": { + "type": "string", + "maxLength": 20, + "description": "It delimits each value of the field with a predefined character." + }, + "errorMsg": { + "type": "string", + "description": "Custom error message.", + "maxLength": 400 + }, + "RangeValue": { + "type": "array", + "description": "Range of allowed values as a two-element array [min, max].", + "items": { + "type": "number" + } + }, + "disableonEdit": { + "type": "boolean", + "description": "When the form is in edit mode, the field becomes unable to be edited.", + "default": false + }, + "entityLabel": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "tooltip": { + "type": "string", + "description": "Displays a tooltip beside the label." + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + }, + "encrypted": { + "type": "boolean", + "description": "To encrypt that particular field.", + "default": false + }, + "display": { + "type": "boolean", + "description": "It chooses whether or not to display the field.", + "default": true + }, + "enable": { + "type": "boolean", + "description": "The enable property sets whether a field is enabled or not.", + "default": true + }, + "requiredWhenVisible": { + "type": "boolean", + "description": "It makes the field required on the UI when it appears. It is used only for visibility.", + "default": false + }, + "fieldToModify": { + "type": "object", + "description": "Defines a trigger condition and the resulting field modifications when that condition is met.", + "properties": { + "fieldValue": { + "description": "Trigger value that activates the field modifications. Use [[any_other_value]] to trigger for any value other than explicitly specified ones.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "Regex pattern that will be used to match against component value" + } + } + } + ] + }, + "mode": { + "type": "string", + "description": "Restricts modifications to a specific form mode. If omitted, modifications apply to all modes.", + "enum": [ + "create", + "edit", + "config", + "clone" + ] + }, + "fieldsToModify": { + "type": "array", + "description": "Array of field modifications to apply when the trigger condition is met.", + "items": { + "$ref": "#/definitions/singleFieldToModify" + }, + "minItems": 1 + } + }, + "required": [ + "fieldValue", + "fieldsToModify" + ] + }, + "markdownMessageText": { + "type": "object", + "properties": { + "markdownType": { + "const": "text", + "type": "string", + "description": "Exactly: text" + }, + "text": { + "type": "string", + "description": "Declare message content" + }, + "color": { + "type": "string", + "description": "Specify color of displayied text. Accepts all CSS colors" + } + }, + "required": [ + "markdownType", + "text" + ] + }, + "markdownMessageHybrid": { + "type": "object", + "properties": { + "markdownType": { + "const": "hybrid", + "type": "string", + "description": "Exactly: hybrid" + }, + "text": { + "type": "string", + "description": "Declare message content" + }, + "token": { + "type": "string", + "description": "Declare string that will be swapped into link" + }, + "linkText": { + "type": "string", + "description": "Declare string that will put in place of token" + }, + "link": { + "type": "string", + "description": "Declare url that will use for redirection" + } + }, + "required": [ + "markdownType", + "text", + "token", + "link", + "linkText" + ] + }, + "markdownMessageLink": { + "type": "object", + "properties": { + "markdownType": { + "const": "link", + "type": "string", + "description": "Exactly: link" + }, + "text": { + "type": "string", + "description": "Declare message content" + }, + "link": { + "type": "string", + "description": "Declare url used for redirection" + } + }, + "required": [ + "markdownType", + "text", + "link" + ] + }, + "markdownMessagePlainText": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "Declare message content" + } + }, + "required": [ + "text" + ] + }, + "markdownMessage": { + "description": "Message that will be displayed as additional information", + "anyOf": [ + { + "$ref": "#/definitions/markdownMessageText" + }, + { + "$ref": "#/definitions/markdownMessageHybrid" + }, + { + "$ref": "#/definitions/markdownMessageLink" + }, + { + "$ref": "#/definitions/markdownMessagePlainText" + } + ] + }, + "singleFieldToModify": { + "type": "object", + "description": "Configuration for modifying a specific field's properties based on another field's value.", + "properties": { + "fieldId": { + "type": "string", + "description": "Identifier of the field to be modified when the trigger condition is met." + }, + "display": { + "type": "boolean", + "description": "Controls whether the target field is visible (true) or hidden (false)." + }, + "value": { + "description": "Sets the value of the target field when the trigger condition is met.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ] + }, + "disabled": { + "type": "boolean", + "description": "Controls whether the target field is disabled (true) or enabled (false)." + }, + "required": { + "type": "boolean", + "description": "Controls whether the target field is required (true) or optional (false)." + }, + "help": { + "$ref": "#/definitions/help" + }, + "label": { + "type": "string", + "description": "Sets the display label text for the target field." + }, + "markdownMessage": { + "$ref": "#/definitions/markdownMessage" + }, + "hideForPlatform": { + "$ref": "#/definitions/HideForPlatform" + } + }, + "required": [ + "fieldId" + ] + }, + "modifyFieldsOnValue": { + "type": "array", + "description": "Dynamic field modification system that changes field properties based on the current value of the parent field.", + "items": { + "$ref": "#/definitions/fieldToModify" + } + }, + "AutoCompleteFields": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "$ref": "#/definitions/entityLabel" + }, + "children": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "#/definitions/ValueLabelPair" + } + } + }, + "required": [ + "label", + "children" + ] + } + }, + { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "#/definitions/ValueLabelPair" + } + } + ] + }, + "IntervalValue": { + "description": "Valid interval values: -1, positive numbers (seconds), or CRON expressions for scheduling.", + "anyOf": [ + { + "type": "number", + "const": -1 + }, + { + "type": "number", + "minimum": 0 + }, + { + "type": "string", + "pattern": "^((?:-1|\\d+(?:\\.\\d+)?)|(([\\*\\d{1,2}\\,\\-\\/]+\\s){4}[\\*\\d{1,2}\\,\\-\\/]+))$" + } + ] + }, + "Groups": { + "type": "array", + "description": "It is used to divide forms into distinct sections, each comprising relevant fields.", + "items": { + "type": "object", + "properties": { + "options": { + "type": "object", + "properties": { + "isExpandable": { + "type": "boolean", + "description": "Used to hide/show fields of the group.", + "default": false + }, + "expand": { + "type": "boolean", + "description": "Used to show all fields of the group while opening the form.", + "default": false + } + } + }, + "label": { + "type": "string", + "maxLength": 100, + "description": "Displays the title of a specific group." + }, + "fields": { + "type": "array", + "description": "specifies the list of fields in a group. All fields must be present in the entity.", + "items": { + "type": "string", + "pattern": "^\\w+$" + } + } + }, + "required": [ + "label", + "fields" + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/common/entity.json b/splunk_add_on_ucc_framework/schema/common/entity.json new file mode 100644 index 0000000000..ce41e8f668 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/common/entity.json @@ -0,0 +1,1590 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "common/entity.json", + "title": "AnyOfEntity", + "type": "array", + "description": "It is a list of fields and their properties.", + "definitions": { + "DefaultOAuthFields": { + "type": "object", + "properties": { + "label": { + "type": "string", + "maxLength": 100, + "description": "Text displayed next to entity field" + }, + "field": { + "type": "string", + "maxLength": 100, + "description": "Must keep it as in examples. It is for mandatory fields as mentioned before." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "options": { + "type": "object", + "properties": { + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + }, + "validators": { + "$ref": "./validator.json" + } + }, + "additionalProperties": false + }, + "OAuthFields": { + "anyOf": [ + { + "$ref": "#/definitions/DefaultOAuthFields" + }, + { + "$ref": "#/definitions/CheckboxGroupEntity" + }, + { + "$ref": "#/definitions/CheckboxTreeEntity" + }, + { + "$ref": "#/definitions/TextEntity" + }, + { + "$ref": "#/definitions/TextareaEntity" + }, + { + "$ref": "#/definitions/SingleSelectEntity" + }, + { + "$ref": "#/definitions/MultipleSelectEntity" + }, + { + "$ref": "#/definitions/CheckboxEntity" + }, + { + "$ref": "#/definitions/DateEntity" + }, + { + "$ref": "#/definitions/RadioEntity" + }, + { + "$ref": "#/definitions/LinkEntity" + }, + { + "$ref": "#/definitions/FileEntity" + } + ] + }, + "CheckboxGroupEntity": { + "type": "object", + "properties": { + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "type": { + "const": "checkboxGroup", + "type": "string", + "description": "Exactly: checkboxGroup" + }, + "options": { + "type": "object", + "properties": { + "delimiter": { + "$ref": "./common.json#/definitions/delimiter" + }, + "groups": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "options": { + "type": "object", + "properties": { + "isExpandable": { + "type": "boolean", + "default": false + }, + "expand": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "required": [ + "label", + "fields" + ], + "additionalProperties": false + } + }, + "rows": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string" + }, + "checkbox": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "defaultValue": { + "type": "boolean", + "description": "The initial input value." + } + }, + "additionalProperties": false + }, + "input": { + "type": "object", + "properties": { + "defaultValue": { + "type": "number", + "description": "The initial input value." + }, + "required": { + "type": "boolean", + "default": false + }, + "validators": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/NumberValidator" + } + ] + } + } + }, + "additionalProperties": false + } + }, + "required": [ + "field" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + } + }, + "required": [ + "rows" + ], + "additionalProperties": false + }, + "validators": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/RegexValidator" + } + ] + } + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "CheckboxTreeEntity": { + "type": "object", + "properties": { + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "type": { + "const": "checkboxTree", + "type": "string", + "description": "Exactly: checkboxTree" + }, + "disabled": { + "type": "boolean", + "default": false + }, + "options": { + "type": "object", + "properties": { + "delimiter": { + "$ref": "./common.json#/definitions/delimiter" + }, + "groups": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "options": { + "type": "object", + "properties": { + "isExpandable": { + "type": "boolean", + "default": false + }, + "expand": { + "type": "boolean", + "default": false + }, + "disabled": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "required": [ + "label", + "fields" + ], + "additionalProperties": false + } + }, + "rows": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string" + }, + "checkbox": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "defaultValue": { + "type": "boolean", + "description": "The initial input value." + }, + "disabled": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "required": [ + "field" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + } + }, + "required": [ + "rows" + ], + "additionalProperties": false + }, + "validators": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/RegexValidator" + } + ] + } + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "RadioEntity": { + "type": "object", + "properties": { + "type": { + "const": "radio", + "type": "string", + "description": "Exactly: radio" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "items": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "./common.json#/definitions/ValueLabelPair" + } + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "required": [ + "items" + ], + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "DateEntity": { + "type": "object", + "properties": { + "type": { + "const": "date", + "type": "string", + "description": "Exactly: date" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "options": { + "type": "object", + "description": "To specify an additional attribute for a particular type of entity, such as items for a radio bar.", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + }, + "locale": { + "type": "string", + "description": "Locale set by language and localization specifiers. Default: 'en_US', some other examples 'en-GB', 'fr-FR', 'zh-CN', 'ja-JP', 'es-ES'" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false + }, + "FileEntity": { + "type": "object", + "properties": { + "type": { + "const": "file", + "type": "string", + "description": "Exactly: file" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "validators": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/StringValidator" + }, + { + "$ref": "./validator.json#/definitions/RegexValidator" + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "maxFileSize": { + "type": "number", + "default": 500, + "description": "It sets the maximum file size in KB that a user can upload." + }, + "fileSupportMessage": { + "type": "string", + "description": "It displays a message inside a file component." + }, + "supportedFileTypes": { + "type": "array", + "description": "It is a list of the file types that the user can upload.", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "useBase64Encoding": { + "type": "boolean", + "default": false, + "description": "It defines used encoding for files. If true base64 will be used, if false utf-8 is applied." + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false + }, + "OAuthEntity": { + "type": "object", + "properties": { + "type": { + "const": "oauth", + "type": "string", + "description": "Exactly: oauth" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "type": "boolean", + "description": "Specifies whether the field is required or not.", + "default": true + }, + "encrypted": { + "type": "boolean", + "description": "Should be true if the user wants that particular field encrypted, otherwise, there is no need to have this parameter.", + "default": false + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "auth_type": { + "type": "array", + "items": { + "anyOf": [ + { + "const": "basic", + "type": "string", + "description": "Exactly: basic" + }, + { + "const": "oauth", + "type": "string", + "description": "Exactly: oauth" + }, + { + "const": "oauth_client_credentials", + "type": "string", + "description": "Exactly: oauth_client_credentials" + }, + { + "type": "string", + "description": "Any different value that is not one of the above will be treated as a custom auth type." + } + ] + }, + "additionalProperties": false + }, + "oauth_type_labels": { + "type": "object", + "description": "It is used to set the label for each authentication type in the auth_type dropdown.", + "properties": { + "basic": { + "type": "string", + "default": "Basic Authentication", + "description": "Label for Basic Authentication type." + }, + "oauth": { + "type": "string", + "default": "OAuth 2.0 with Authorization Code Grant (interactive)", + "description": "Label for OAuth 2.0 with Authorization Code Grant (interactive) authentication type." + }, + "oauth_client_credentials": { + "type": "string", + "default": "OAuth 2.0 with Client Credentials Grant (non-interactive)", + "description": "Label for OAuth 2.0 with Client Credentials Grant (non-interactive) authentication type." + } + }, + "additionalProperties": true + }, + "basic": { + "type": "array", + "description": "Must be present only if the auth_type is [“basic”]. Will have a list of fields for you to add in the basic authentication flow.", + "items": { + "$ref": "#/definitions/OAuthFields" + } + }, + "oauth": { + "type": "array", + "description": "OAuth 2.0 with Authorization Code Grant (interactive). Will have a list of fields for you to add in the oauth authentication flow.", + "items": { + "$ref": "#/definitions/OAuthFields" + } + }, + "oauth_client_credentials": { + "type": "array", + "description": "OAuth 2.0 with Client Credentials Grant (non-interactive). Will have a list of fields for you to add in the oauth authentication flow.", + "items": { + "$ref": "#/definitions/OAuthFields" + } + }, + "auth_label": { + "type": "string", + "maxLength": 250, + "description": "Allows the user to have the custom label for the Auth Type dropdown." + }, + "oauth_popup_width": { + "type": "number", + "default": 600, + "description": "Width in pixels of the pop-up window that will open for oauth authentication" + }, + "oauth_popup_height": { + "type": "number", + "default": 600, + "description": "Height in pixels of the pop-up window that will open for oauth authentication" + }, + "oauth_timeout": { + "type": "number", + "description": "Timeout in seconds for oauth authentication ", + "default": 180 + }, + "auth_code_endpoint": { + "type": "string", + "maxLength": 350, + "description": "Must be present and its value should be the endpoint value for getting the auth_code using the app." + }, + "access_token_endpoint": { + "type": "string", + "maxLength": 350, + "description": "Must be present and its value should be the endpoint value for getting the access_token using the auth_code received." + }, + "auth_endpoint_token_access_type": { + "type": "string", + "maxLength": 350, + "description": "Optional parameter that is mapped into the value of the token_access_type query param in the authorization url." + }, + "oauth_state_enabled": { + "type": "boolean", + "default": false, + "description": "Used to include the state for oauth authentication" + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + }, + "additionalProperties": true + }, + "allOf": [ + { + "if": { + "properties": { + "auth_type": { + "type": "array", + "contains": { + "const": "basic", + "type": "string", + "description": "Exactly: basic" + } + } + } + }, + "then": { + "required": [ + "basic" + ] + } + }, + { + "if": { + "properties": { + "auth_type": { + "type": "array", + "contains": { + "const": "oauth", + "type": "string", + "description": "Exactly: oauth" + } + } + } + }, + "then": { + "required": [ + "oauth" + ] + } + } + ], + "required": [ + "auth_type" + ] + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "TextEntity": { + "type": "object", + "properties": { + "type": { + "const": "text", + "type": "string", + "description": "Exactly: text" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "description": "The initial input value.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "validators": { + "$ref": "./validator.json" + }, + "options": { + "type": "object", + "description": "To specify an additional attribute for a particular type of entity, such as items for a radio bar.", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false + }, + "TextareaEntity": { + "type": "object", + "properties": { + "type": { + "const": "textarea", + "type": "string", + "description": "Exactly: textarea" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "validators": { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/StringValidator" + }, + { + "$ref": "./validator.json#/definitions/RegexValidator" + }, + { + "$ref": "./validator.json#/definitions/EmailValidator" + }, + { + "$ref": "./validator.json#/definitions/Ipv4Validator" + }, + { + "$ref": "./validator.json#/definitions/UrlValidator" + }, + { + "$ref": "./validator.json#/definitions/DateValidator" + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "rowsMin": { + "type": "number", + "default": 12, + "description": "Maximum number of rows to display." + }, + "rowsMax": { + "type": "number", + "default": 8, + "description": "Minimum number of rows to display." + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false + }, + "SingleSelectEntity": { + "type": "object", + "properties": { + "type": { + "const": "singleSelect", + "type": "string", + "description": "Exactly: singleSelect" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "description": "The initial input value.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "validators": { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/StringValidator" + }, + { + "$ref": "./validator.json#/definitions/RegexValidator" + }, + { + "$ref": "./validator.json#/definitions/EmailValidator" + }, + { + "$ref": "./validator.json#/definitions/Ipv4Validator" + }, + { + "$ref": "./validator.json#/definitions/UrlValidator" + }, + { + "$ref": "./validator.json#/definitions/DateValidator" + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "disableSearch": { + "type": "boolean", + "default": false, + "description": "It determines whether to show the filter box. When false, the children are automatically filtered based on the label." + }, + "createSearchChoice": { + "type": "boolean", + "description": "It allows the user to add arbitrary values.", + "default": false + }, + "referenceName": { + "type": "string", + "description": "Dropdown options will be generated via an API call to the service’s restHandler." + }, + "endpointUrl": { + "type": "string", + "description": "Dropdown options will be generated via an API call to that endpoint." + }, + "allowList": { + "type": "string", + "description": "It only accepts options that match the regex based on the name attribute when received via an API call using endpointUrl and referenceName. It is applied before denyList." + }, + "denyList": { + "type": "string", + "description": "It filters options that don’t match the regex based on the name attribute when received via an API call using endpointUrl and referenceName." + }, + "labelField": { + "type": "string", + "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used.```item.content?.[labelField]``` " + }, + "valueField": { + "type": "string", + "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used as value for each item.```item.content?.[valueField]```" + }, + "autoCompleteFields": { + "$ref": "./common.json#/definitions/AutoCompleteFields" + }, + "dependencies": { + "type": "array", + "description": "It is used to update the options via an API call when the value of any field in the dependencies list is updated.", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "items": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "./common.json#/definitions/ValueLabelPair" + } + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "MultipleSelectEntity": { + "type": "object", + "properties": { + "type": { + "const": "multipleSelect", + "type": "string", + "description": "Exactly: multipleSelect" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "validators": { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "$ref": "./validator.json#/definitions/StringValidator" + }, + { + "$ref": "./validator.json#/definitions/RegexValidator" + }, + { + "$ref": "./validator.json#/definitions/EmailValidator" + }, + { + "$ref": "./validator.json#/definitions/Ipv4Validator" + }, + { + "$ref": "./validator.json#/definitions/UrlValidator" + }, + { + "$ref": "./validator.json#/definitions/DateValidator" + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "disableSearch": { + "type": "boolean", + "default": false, + "description": "It determines whether to show the filter box. When false, the children are automatically filtered based on the label." + }, + "createSearchChoice": { + "type": "boolean", + "default": false, + "description": "It allows the user to add arbitrary values." + }, + "referenceName": { + "type": "string", + "description": "Dropdown options will be generated via an API call to the service’s restHandler." + }, + "endpointUrl": { + "type": "string", + "description": "Dropdown options will be generated via an API call to that endpoint." + }, + "allowList": { + "type": "string", + "description": "It only accepts options that match the regex based on the name attribute when received via an API call using endpointUrl and referenceName. It is applied before denyList." + }, + "denyList": { + "type": "string", + "description": "It filters options that don’t match the regex based on the name attribute when received via an API call using endpointUrl and referenceName." + }, + "labelField": { + "type": "string", + "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used.```item.content?.[labelField]``` " + }, + "valueField": { + "type": "string", + "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used as value for each item.```item.content?.[valueField]```" + }, + "autoCompleteFields": { + "$ref": "./common.json#/definitions/AutoCompleteFields" + }, + "dependencies": { + "type": "array", + "description": "It is used to update the options via an API call when the value of any field in the dependencies list is updated.", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "items": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "./common.json#/definitions/ValueLabelPair" + } + }, + "delimiter": { + "type": "string", + "maxLength": 1, + "description": "It delimits each value of the field with a predefined character." + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "CheckboxEntity": { + "type": "object", + "properties": { + "type": { + "const": "checkbox", + "type": "string", + "description": "Exactly: checkbox" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number" + } + ], + "description": "The initial input value." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "disableonEdit": { + "$ref": "./common.json#/definitions/disableonEdit" + }, + "enable": { + "$ref": "./common.json#/definitions/enable" + }, + "requiredWhenVisible": { + "$ref": "./common.json#/definitions/requiredWhenVisible" + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + } + }, + "additionalProperties": false + }, + "modifyFieldsOnValue": { + "$ref": "./common.json#/definitions/modifyFieldsOnValue" + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false + }, + "IndexEntity": { + "type": "object", + "description": "Index selection component that provides a dropdown of available Splunk indexes with built-in validation.", + "properties": { + "type": { + "const": "index" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Display label for the index selection field." + }, + "defaultValue": { + "type": "string", + "description": "Default index to select when the form loads." + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "required": { + "$ref": "./common.json#/definitions/required" + } + }, + "required": [ + "type", + "field", + "label" + ], + "additionalProperties": false + }, + "LinkEntity": { + "type": "object", + "properties": { + "type": { + "const": "helpLink", + "type": "string", + "description": "Exactly: helpLink" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "options": { + "type": "object", + "properties": { + "display": { + "$ref": "./common.json#/definitions/display" + }, + "text": { + "type": "string", + "description": "It is a message to be displayed." + }, + "link": { + "type": "string", + "description": "It is a link where the user will be redirected." + }, + "hideForPlatform": { + "$ref": "./common.json#/definitions/HideForPlatform" + }, + "links": { + "$ref": "./common.json#/definitions/links" + } + }, + "required": [ + "text" + ], + "additionalProperties": false + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + } + }, + "required": [ + "field", + "type", + "options" + ], + "additionalProperties": false + }, + "CustomEntity": { + "type": "object", + "properties": { + "type": { + "const": "custom", + "type": "string", + "description": "Exactly: custom" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + }, + "encrypted": { + "$ref": "./common.json#/definitions/encrypted" + }, + "defaultValue": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "The initial input value." + }, + "options": { + "$ref": "./common.json#/definitions/CustomComponent" + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false + }, + "IntervalEntity": { + "type": "object", + "properties": { + "type": { + "const": "interval", + "description": "Exactly: interval" + }, + "field": { + "$ref": "./common.json#/definitions/Field" + }, + "label": { + "$ref": "./common.json#/definitions/entityLabel" + }, + "defaultValue": { + "$ref": "./common.json#/definitions/IntervalValue" + }, + "options": { + "type": "object", + "properties": { + "range": { + "$ref": "./common.json#/definitions/RangeValue" + } + }, + "additionalProperties": false, + "required": [ + "range" + ] + }, + "help": { + "$ref": "./common.json#/definitions/help" + }, + "tooltip": { + "$ref": "./common.json#/definitions/tooltip" + }, + "required": { + "$ref": "./common.json#/definitions/required" + } + }, + "required": [ + "type", + "field", + "label" + ], + "additionalProperties": false + } + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/CheckboxGroupEntity" + }, + { + "$ref": "#/definitions/CheckboxTreeEntity" + }, + { + "$ref": "#/definitions/TextEntity" + }, + { + "$ref": "#/definitions/TextareaEntity" + }, + { + "$ref": "#/definitions/SingleSelectEntity" + }, + { + "$ref": "#/definitions/MultipleSelectEntity" + }, + { + "$ref": "#/definitions/CheckboxEntity" + }, + { + "$ref": "#/definitions/DateEntity" + }, + { + "$ref": "#/definitions/RadioEntity" + }, + { + "$ref": "#/definitions/LinkEntity" + }, + { + "$ref": "#/definitions/FileEntity" + }, + { + "$ref": "#/definitions/OAuthEntity" + }, + { + "$ref": "#/definitions/CustomEntity" + }, + { + "$ref": "#/definitions/IntervalEntity" + }, + { + "$ref": "#/definitions/IndexEntity" + } + ] + } +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/common/validator.json b/splunk_add_on_ucc_framework/schema/common/validator.json new file mode 100644 index 0000000000..05dcf74aba --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/common/validator.json @@ -0,0 +1,180 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "common/validator.json", + "title": "Any Validator Schemas", + "type": "array", + "description": "It is used to validate the values of fields using various validators.", + "definitions": { + "NumberValidator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "number", + "type": "string", + "description": "Exactly: number" + }, + "range": { + "$ref": "./common.json#/definitions/RangeValue" + }, + "isInteger": { + "type": "boolean", + "description": "Specifies if the number should be an integer (true) or can be a float (false). Default value is false.", + "default": false + } + }, + "required": [ + "type", + "range" + ], + "additionalProperties": false + }, + "RegexValidator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "regex", + "type": "string", + "description": "Exactly: regex" + }, + "pattern": { + "type": "string", + "description": "Regular expression pattern to validate against." + } + }, + "required": [ + "type", + "pattern" + ], + "additionalProperties": false + }, + "StringValidator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "string", + "type": "string", + "description": "Exactly: string" + }, + "minLength": { + "type": "number", + "minimum": 0, + "description": "Specifies the minimum number of characters allowed." + }, + "maxLength": { + "type": "number", + "minimum": 0, + "description": "Specifies the maximum number of characters allowed." + } + }, + "required": [ + "type", + "minLength", + "maxLength" + ], + "additionalProperties": false + }, + "EmailValidator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "email", + "type": "string", + "description": "Exactly: email" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "Ipv4Validator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "ipv4", + "type": "string", + "description": "Exactly: ipv4" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "UrlValidator": { + "type": "object", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "const": "url", + "type": "string", + "description": "Exactly: url" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "DateValidator": { + "type": "object", + "description": "It is validated if the field’s value is a date in the ISO 8601 format. It uses the regex from moment.js.", + "properties": { + "errorMsg": { + "$ref": "./common.json#/definitions/errorMsg" + }, + "type": { + "description": "Exactly: date", + "type": "string", + "const": "date" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + } + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/NumberValidator" + }, + { + "$ref": "#/definitions/StringValidator" + }, + { + "$ref": "#/definitions/RegexValidator" + }, + { + "$ref": "#/definitions/EmailValidator" + }, + { + "$ref": "#/definitions/Ipv4Validator" + }, + { + "$ref": "#/definitions/UrlValidator" + }, + { + "$ref": "#/definitions/DateValidator" + } + ] + } +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/schema.json b/splunk_add_on_ucc_framework/schema/schema.json index 6e17fa0893..9534adcb0b 100644 --- a/splunk_add_on_ucc_framework/schema/schema.json +++ b/splunk_add_on_ucc_framework/schema/schema.json @@ -1,4458 +1,19 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AlertSingleSelectSplunkSearchEntity": { - "type": "object", - "description": "Alerts configuration. The alert action can help a user to take action on the alerts that have been triggered. The knowledge from Splunk can be sent to an outside service or to pull additional or detailed information related to the trigger details.", - "properties": { - "field": { - "type": "string", - "pattern": "^\\w+$", - "description": "Field identifier used in scripts to access the user input value. Referenced as param. in alert_actions.conf." - }, - "label": { - "type": "string", - "maxLength": 30, - "description": "Display text shown in the alert action user interface." - }, - "type": { - "const": "singleSelectSplunkSearch", - "type": "string", - "description": "Exactly: singleSelectSplunkSearch" - }, - "help": { - "type": "string", - "maxLength": 200, - "description": "Help text displayed under the field to provide context about the field's usage." - }, - "defaultValue": { - "description": "The initial input value.", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string", - "maxLength": 250 - }, - { - "type": "boolean" - } - ] - }, - "required": { - "type": "boolean", - "default": false, - "description": "Specifies whether the field is required or not." - }, - "search": { - "type": "string", - "maxLength": 200, - "description": "A Splunk SPL query that returns results for the dropdown options. Can query REST API, lookup tables, or indexed data." - }, - "valueField": { - "type": "string", - "maxLength": 200, - "description": "Field name to use for dropdown option values. In some cases, you can use the same field for both label and value. In other cases, you might need human-readable labels from one field and corresponding values from another field. Note: Applicable when a search property is defined." - }, - "labelField": { - "type": "string", - "maxLength": 200, - "description": "Field name to use for dropdown option labels. Labels from this field are visible in the dropdown interface. Note: Applicable when a search property is defined." - }, - "options": { - "type": "object", - "description": "Configuration options for static dropdown choices displayed in the alert action UI.", - "properties": { - "items": { - "type": "array", - "description": "Array of predefined options with labels and values for user selection.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - } - } - } - }, - "required": [ - "field", - "label", - "type", - "search", - "valueField", - "labelField" - ], - "additionalProperties": false - }, - "AlertTextEntity": { - "type": "object", - "properties": { - "type": { - "const": "text", - "type": "string", - "description": "Exactly: text" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "help": { - "$ref": "#/definitions/help" - }, - "defaultValue": { - "description": "The initial input value.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "required": { - "$ref": "#/definitions/required" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "AlertTextareaEntity": { - "type": "object", - "properties": { - "type": { - "const": "textarea", - "type": "string", - "description": "Exactly: textarea" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "required": { - "$ref": "#/definitions/required" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "AlertCheckboxEntity": { - "type": "object", - "properties": { - "type": { - "const": "checkbox", - "type": "string", - "description": "Exactly: checkbox" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "number" - } - ], - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "required": { - "$ref": "#/definitions/required" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "AlertSingleSelectEntity": { - "type": "object", - "properties": { - "type": { - "const": "singleSelect", - "type": "string", - "description": "Exactly: singleSelect" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "description": "The initial input value.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "help": { - "$ref": "#/definitions/help" - }, - "required": { - "$ref": "#/definitions/required" - }, - "options": { - "type": "object", - "description": "Static choices that a user can select in the alert action UI.", - "properties": { - "items": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - } - } - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "AlertRadioEntity": { - "type": "object", - "properties": { - "type": { - "const": "radio", - "type": "string", - "description": "Exactly: radio" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "description": "The initial input value.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "help": { - "$ref": "#/definitions/help" - }, - "required": { - "$ref": "#/definitions/required" - }, - "options": { - "type": "object", - "description": "Static choices that a user can select in the alert action UI.", - "properties": { - "items": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - } - } - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "Alerts": { - "type": "object", - "description": "The alert action can help a user to take action on the alerts that have been triggered. ", - "properties": { - "name": { - "type": "string", - "pattern": "^[a-zA-Z0-9_]+$", - "maxLength": 100, - "description": "Alphanumeric name that would be used to generate the Python file for the alert action." - }, - "label": { - "type": "string", - "maxLength": 100, - "description": "User-friendly name of the alert action that would be seen in the Trigger Actions." - }, - "description": { - "type": "string", - "description": "Description of the alert action." - }, - "iconFileName": { - "type": "string", - "maxLength": 100, - "default": "alerticon.png", - "description": "The name of the icon to be shown in the Alert Action UI. It has to be present in /appserver/static/ directory." - }, - "adaptiveResponse": { - "type": "object", - "description": "Define only if the alert action will be visible for AR in Splunk Enterprise Security app. Refer documentation for complete details.", - "properties": { - "task": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "description": "The function or functions performed by the modular action." - }, - "supportsAdhoc": { - "type": "boolean", - "default": false, - "description": "Specifies if the modular action supports adhoc invocations." - }, - "supportsCloud": { - "type": "boolean", - "default": true, - "description": "Specifies if the modular actions supports the “cloud” model." - }, - "subject": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "description": "The object or objects that the modular action’s task(s) can be performed on (i.e. “endpoint.file”)." - }, - "category": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "description": "The category or categories the modular action belongs to." - }, - "technology": { - "type": "array", - "items": { - "$ref": "#/definitions/Technology" - }, - "minItems": 1, - "description": "The technology or technologies that the modular action supports." - }, - "drilldownUri": { - "type": "string", - "description": "Specifies a custom target for viewing the events outputted as a result of the action. Custom target can specify app and/or view depending on syntax." - }, - "sourcetype": { - "type": "string", - "pattern": "^[a-zA-Z0-9:-_]+$", - "maxLength": 50, - "description": "The sourcetype in which the result of the AR alert action would be written to. The value is updated in the alert action script. If you don’t specify any value you can update your alert action script manually once it is generated." - } - }, - "required": [ - "task", - "subject", - "category", - "technology" - ] - }, - "entity": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/AlertTextEntity" - }, - { - "$ref": "#/definitions/AlertTextareaEntity" - }, - { - "$ref": "#/definitions/AlertCheckboxEntity" - }, - { - "$ref": "#/definitions/AlertSingleSelectEntity" - }, - { - "$ref": "#/definitions/AlertRadioEntity" - }, - { - "$ref": "#/definitions/AlertSingleSelectSplunkSearchEntity" - } - ] - } - }, - "customScript": { - "type": "string", - "maxLength": 100, - "description": "A Python script that would have validation and logic for alert action execution. The script should be present at /bin/. Refer documentation for more information." - } - }, - "required": [ - "name", - "label", - "description" - ], - "additionalProperties": false - }, - "customSearchCommand": { - "type": "object", - "description": "Support for custom Search Command.", - "properties": { - "commandName": { - "type": "string", - "pattern": "^[a-z0-9]+$", - "maxLength": 100, - "description": "Name of the custom Search Command." - }, - "fileName": { - "type": "string", - "pattern": "^\\w+\\.py$", - "description": "Name of the file which contains logic for custom search command. The file should be a python file only." - }, - "commandType": { - "type": "string", - "description": "Type of the custom search command. There are 4 types of command i.e generating, streaming, transforming and dataset processing", - "enum": [ - "generating", - "streaming", - "dataset processing", - "transforming" - ] - }, - "requiredSearchAssistant": { - "type": "boolean", - "default": false, - "description": "Specifies if search assistant is required or not. If yes then searchbnf.conf will be generated." - }, - "description": { - "type": "string", - "description": "Description of the custom search command. It is an required attribute for searchbnf.conf." - }, - "syntax": { - "type": "string", - "maxLength": 100, - "description": "Syntax for the custom search command. It is an required attribute for searchbnf.conf." - }, - "usage": { - "type": "string", - "description": "Specifies what will be the usage of custom search command. It is an required attribute for searchbnf.conf.", - "enum": [ - "public", - "private", - "deprecated" - ] - }, - "arguments": { - "type": "array", - "items": { - "$ref": "#/definitions/arguments" - }, - "minItems": 1 - } - }, - "required": [ - "commandName", - "fileName", - "commandType", - "arguments" - ], - "additionalProperties": false - }, - "arguments": { - "type": "object", - "description": "Arguments used for custom search command", - "properties": { - "name": { - "type": "string", - "description": "Name of the argument" - }, - "required": { - "type": "boolean", - "default": true, - "description": "Specifies if the argument is required or not" - }, - "validate": { - "$ref": "#/definitions/CustomSearchCommandValidator" - }, - "defaultValue": { - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "description": "Provide default value to the arguments passed for custom search command" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - }, - "CustomSearchCommandValidator": { - "type": "object", - "description": "It is used to validate the values of arguments for custom search command", - "oneOf": [ - { - "$ref": "#/definitions/CustomIntegerValidator" - }, - { - "$ref": "#/definitions/CustomFloatValidator" - }, - { - "$ref": "#/definitions/CustomRegularExpressionValidator" - }, - { - "$ref": "#/definitions/CustomFieldnameValidator" - }, - { - "$ref": "#/definitions/CustomBooleanValidator" - } - ] - }, - "CustomIntegerValidator": { - "type": "object", - "properties": { - "minimum": { - "type": "number", - "description": "Minimum value used for validation" - }, - "maximum": { - "type": "number", - "description": "Maximum value used for validation" - }, - "type": { - "const": "Integer", - "type": "string", - "description": "This is integer Validator for custom search command, provide at least one of `minimumValue` or `maximumValue`" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "CustomFloatValidator": { - "type": "object", - "properties": { - "minimumValue": { - "type": "number", - "description": "Minimum value used for validation" - }, - "maximumValue": { - "type": "number", - "description": "Maximum value used for validation" - }, - "type": { - "const": "Float", - "type": "string", - "description": "This is Float Validator for custom search command, provide at least one of `minimumValue` or `maximumValue` for validation purpose." - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "CustomRegularExpressionValidator": { - "type": "object", - "properties": { - "type": { - "const": "RegularExpression", - "type": "string", - "description": "This is RegularExpression Validator which validates if the input value is a valid regular expression pattern or not." - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "CustomFieldnameValidator": { - "type": "object", - "properties": { - "type": { - "const": "Fieldname", - "type": "string", - "description": "Validates field name option values." - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "CustomBooleanValidator": { - "type": "object", - "properties": { - "type": { - "const": "Boolean", - "type": "string", - "description": "Validates Boolean option values." - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "ConfigurationPage": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "Title of Configuration page", - "maxLength": 60 - }, - "description": { - "type": "string", - "description": "Description under title of Configuration page", - "maxLength": 200 - }, - "subDescription": { - "$ref": "#/definitions/SubDescription" - }, - "tabs": { - "description": "Array of forms to be displayed in separate tabs", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/TabContent" - }, - { - "$ref": "#/definitions/PredefinedLoggingTab" - }, - { - "$ref": "#/definitions/PredefinedProxyTab" - } - ] - }, - "minItems": 1 - }, - "capabilities": { - "$ref": "#/definitions/capabilities" - } - }, - "required": [ - "title", - "tabs" - ], - "description": "Page for account configuration, proxy configuration, and logging level configuration.", - "additionalProperties": false - }, - "ConfigurationTable": { - "type": "object", - "properties": { - "moreInfo": { - "type": "array", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string", - "pattern": "^\\w+$", - "description": "Used to display the data in a column." - }, - "label": { - "type": "string", - "maxLength": 30, - "description": "Title of the column." - }, - "mapping": { - "type": "object", - "description": "Used to map field values to more meaningful values." - } - }, - "required": [ - "field", - "label" - ] - }, - "description": "Specifies the list of fields that will be displayed in row form when the user clicks the Row Expand button." - }, - "header": { - "type": "array", - "description": "Specifies the list of columns in the table", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string", - "pattern": "^\\w+$", - "description": "Name of the field where the column data will be displayed." - }, - "label": { - "type": "string", - "maxLength": 30, - "description": "The title of the column" - }, - "mapping": { - "type": "object", - "description": "Used to map field values to more meaningful values." - }, - "customCell": { - "$ref": "#/definitions/CustomCell" - } - }, - "required": [ - "field", - "label" - ] - } - }, - "customRow": { - "$ref": "#/definitions/CustomRow" - }, - "actions": { - "type": "array", - "description": "Specifies what type of action can be performed on the stanza. The supported types are edit, clone, and delete.", - "items": { - "type": "string", - "enum": [ - "edit", - "delete", - "clone" - ] - } - } - }, - "required": [ - "header", - "actions" - ], - "description": "Configuration of single tab", - "additionalProperties": false - }, - "DashboardPage": { - "type": "object", - "properties": { - "panels": { - "type": "array", - "description": "List of panels to be generated. Supported for now: 'Overview', 'Data ingestion', 'Errors in the add-on'.", - "minItems": 1, - "items": { - "$ref": "#/definitions/DashboardPanel" - } - }, - "troubleshooting_url": { - "type": "string", - "description": "Link to external TA documentation used for redirection on error dashboard page", - "format": "uri" - }, - "settings": { - "type": "object", - "description": "Additional settings for monitoring dashboard.", - "properties": { - "custom_tab_name": { - "type": "string" - }, - "custom_license_usage": { - "type": "object", - "description": "Settings for creating custom search query for license usage.", - "properties": { - "determine_by": { - "type": "string", - "description": "Specify what to use (source or sourcetype) to search events in license usage.", - "enum": [ - "source", - "sourcetype", - "host", - "index" - ] - }, - "search_condition": { - "type": "array", - "description": "Elements that will be used as a query condition.", - "minItems": 1, - "items": { - "type": "string" - } - } - }, - "required": [ - "determine_by", - "search_condition" - ], - "additionalProperties": false - }, - "error_panel_log_lvl": { - "type": "array", - "minItems": 1, - "items": { - "anyOf": [ - { - "type": "string", - "enum": [ - "ERROR", - "CRITICAL" - ] - } - ] - }, - "uniqueItems": true - } - }, - "additionalProperties": false - } - }, - "required": [ - "panels" - ], - "description": "The dashboard page provides some additional information about the add-on operations to increase the visibility into what the add-on is actually doing under the hood.", - "additionalProperties": false - }, - "DateValidator": { - "type": "object", - "description": "It is validated if the field’s value is a date in the ISO 8601 format. It uses the regex from moment.js.", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "description": "Exactly: date", - "type": "string", - "const": "date" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "delimiter": { - "type": "string", - "maxLength": 20, - "description": "It delimits each value of the field with a predefined character." - }, - "EmailValidator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "email", - "type": "string", - "description": "Exactly: email" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "SaveValidatorHook": { - "type": "object", - "description": "Apply customized validation", - "properties": { - "saveValidator": { - "type": "string", - "maxLength": 3000, - "description": "Allows you to pass a Javascript function as a string to apply customized validation to form data." - } - }, - "additionalProperties": false - }, - "Groups": { - "type": "array", - "description": "It is used to divide forms into distinct sections, each comprising relevant fields.", - "items": { - "type": "object", - "properties": { - "options": { - "type": "object", - "properties": { - "isExpandable": { - "type": "boolean", - "description": "Used to hide/show fields of the group.", - "default": false - }, - "expand": { - "type": "boolean", - "description": "Used to show all fields of the group while opening the form.", - "default": false - } - } - }, - "label": { - "type": "string", - "maxLength": 100, - "description": "Displays the title of a specific group." - }, - "fields": { - "type": "array", - "description": "specifies the list of fields in a group. All fields must be present in the entity.", - "items": { - "type": "string", - "pattern": "^\\w+$" - } - } - }, - "required": [ - "label", - "fields" - ], - "additionalProperties": false - } - }, - "LinkEntity": { - "type": "object", - "properties": { - "type": { - "const": "helpLink", - "type": "string", - "description": "Exactly: helpLink" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "text": { - "type": "string", - "description": "It is a message to be displayed." - }, - "link": { - "type": "string", - "description": "It is a link where the user will be redirected." - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "links": { - "$ref": "#/definitions/links" - } - }, - "required": [ - "text" - ], - "additionalProperties": false - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - } - }, - "required": [ - "field", - "type", - "options" - ], - "additionalProperties": false - }, - "TextEntity": { - "type": "object", - "properties": { - "type": { - "const": "text", - "type": "string", - "description": "Exactly: text" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "description": "The initial input value.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "validators": { - "$ref": "#/definitions/AnyValidator" - }, - "options": { - "type": "object", - "description": "To specify an additional attribute for a particular type of entity, such as items for a radio bar.", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "TextareaEntity": { - "type": "object", - "properties": { - "type": { - "const": "textarea", - "type": "string", - "description": "Exactly: textarea" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "validators": { - "type": "array", - "minItems": 1, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/StringValidator" - }, - { - "$ref": "#/definitions/RegexValidator" - }, - { - "$ref": "#/definitions/EmailValidator" - }, - { - "$ref": "#/definitions/Ipv4Validator" - }, - { - "$ref": "#/definitions/UrlValidator" - }, - { - "$ref": "#/definitions/DateValidator" - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "rowsMin": { - "type": "number", - "default": 12, - "description": "Maximum number of rows to display." - }, - "rowsMax": { - "type": "number", - "default": 8, - "description": "Minimum number of rows to display." - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "SingleSelectEntity": { - "type": "object", - "properties": { - "type": { - "const": "singleSelect", - "type": "string", - "description": "Exactly: singleSelect" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "description": "The initial input value.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "validators": { - "type": "array", - "minItems": 1, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/StringValidator" - }, - { - "$ref": "#/definitions/RegexValidator" - }, - { - "$ref": "#/definitions/EmailValidator" - }, - { - "$ref": "#/definitions/Ipv4Validator" - }, - { - "$ref": "#/definitions/UrlValidator" - }, - { - "$ref": "#/definitions/DateValidator" - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "disableSearch": { - "type": "boolean", - "default": false, - "description": "It determines whether to show the filter box. When false, the children are automatically filtered based on the label." - }, - "createSearchChoice": { - "type": "boolean", - "description": "It allows the user to add arbitrary values.", - "default": false - }, - "referenceName": { - "type": "string", - "description": "Dropdown options will be generated via an API call to the service’s restHandler." - }, - "endpointUrl": { - "type": "string", - "description": "Dropdown options will be generated via an API call to that endpoint." - }, - "allowList": { - "type": "string", - "description": "It only accepts options that match the regex based on the name attribute when received via an API call using endpointUrl and referenceName. It is applied before denyList." - }, - "denyList": { - "type": "string", - "description": "It filters options that don’t match the regex based on the name attribute when received via an API call using endpointUrl and referenceName." - }, - "labelField": { - "type": "string", - "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used.```item.content?.[labelField]``` " - }, - "valueField": { - "type": "string", - "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used as value for each item.```item.content?.[valueField]```" - }, - "autoCompleteFields": { - "$ref": "#/definitions/AutoCompleteFields" - }, - "dependencies": { - "type": "array", - "description": "It is used to update the options via an API call when the value of any field in the dependencies list is updated.", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "items": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "MultipleSelectEntity": { - "type": "object", - "properties": { - "type": { - "const": "multipleSelect", - "type": "string", - "description": "Exactly: multipleSelect" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "validators": { - "type": "array", - "minItems": 1, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/StringValidator" - }, - { - "$ref": "#/definitions/RegexValidator" - }, - { - "$ref": "#/definitions/EmailValidator" - }, - { - "$ref": "#/definitions/Ipv4Validator" - }, - { - "$ref": "#/definitions/UrlValidator" - }, - { - "$ref": "#/definitions/DateValidator" - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "disableSearch": { - "type": "boolean", - "default": false, - "description": "It determines whether to show the filter box. When false, the children are automatically filtered based on the label." - }, - "createSearchChoice": { - "type": "boolean", - "default": false, - "description": "It allows the user to add arbitrary values." - }, - "referenceName": { - "type": "string", - "description": "Dropdown options will be generated via an API call to the service’s restHandler." - }, - "endpointUrl": { - "type": "string", - "description": "Dropdown options will be generated via an API call to that endpoint." - }, - "allowList": { - "type": "string", - "description": "It only accepts options that match the regex based on the name attribute when received via an API call using endpointUrl and referenceName. It is applied before denyList." - }, - "denyList": { - "type": "string", - "description": "It filters options that don’t match the regex based on the name attribute when received via an API call using endpointUrl and referenceName." - }, - "labelField": { - "type": "string", - "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used.```item.content?.[labelField]``` " - }, - "valueField": { - "type": "string", - "description": "If you use endpointUrl and your data are not simple text data, you can specify here which property of retrieved object should be used as value for each item.```item.content?.[valueField]```" - }, - "autoCompleteFields": { - "$ref": "#/definitions/AutoCompleteFields" - }, - "dependencies": { - "type": "array", - "description": "It is used to update the options via an API call when the value of any field in the dependencies list is updated.", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "items": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - }, - "delimiter": { - "type": "string", - "maxLength": 1, - "description": "It delimits each value of the field with a predefined character." - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "CheckboxEntity": { - "type": "object", - "properties": { - "type": { - "const": "checkbox", - "type": "string", - "description": "Exactly: checkbox" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "number" - } - ], - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "CheckboxGroupEntity": { - "type": "object", - "properties": { - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "type": { - "const": "checkboxGroup", - "type": "string", - "description": "Exactly: checkboxGroup" - }, - "options": { - "type": "object", - "properties": { - "delimiter": { - "$ref": "#/definitions/delimiter" - }, - "groups": { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "options": { - "type": "object", - "properties": { - "isExpandable": { - "type": "boolean", - "default": false - }, - "expand": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - }, - "fields": { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "required": [ - "label", - "fields" - ], - "additionalProperties": false - } - }, - "rows": { - "type": "array", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string" - }, - "checkbox": { - "type": "object", - "properties": { - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "defaultValue": { - "type": "boolean", - "description": "The initial input value." - } - }, - "additionalProperties": false - }, - "input": { - "type": "object", - "properties": { - "defaultValue": { - "type": "number", - "description": "The initial input value." - }, - "required": { - "type": "boolean", - "default": false - }, - "validators": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/NumberValidator" - } - ] - } - } - }, - "additionalProperties": false - } - }, - "required": [ - "field" - ], - "additionalProperties": false - }, - "minItems": 1 - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - } - }, - "required": [ - "rows" - ], - "additionalProperties": false - }, - "validators": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/RegexValidator" - } - ] - } - }, - "required": { - "type": "boolean" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "CheckboxTreeEntity": { - "type": "object", - "properties": { - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "type": { - "const": "checkboxTree", - "type": "string", - "description": "Exactly: checkboxTree" - }, - "disabled": { - "type": "boolean", - "default": false - }, - "options": { - "type": "object", - "properties": { - "delimiter": { - "$ref": "#/definitions/delimiter" - }, - "groups": { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "options": { - "type": "object", - "properties": { - "isExpandable": { - "type": "boolean", - "default": false - }, - "expand": { - "type": "boolean", - "default": false - }, - "disabled": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - }, - "fields": { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "required": [ - "label", - "fields" - ], - "additionalProperties": false - } - }, - "rows": { - "type": "array", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string" - }, - "checkbox": { - "type": "object", - "properties": { - "label": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "defaultValue": { - "type": "boolean", - "description": "The initial input value." - }, - "disabled": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - } - }, - "required": [ - "field" - ], - "additionalProperties": false - }, - "minItems": 1 - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - } - }, - "required": [ - "rows" - ], - "additionalProperties": false - }, - "validators": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/RegexValidator" - } - ] - } - }, - "required": { - "type": "boolean" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "RadioEntity": { - "type": "object", - "properties": { - "type": { - "const": "radio", - "type": "string", - "description": "Exactly: radio" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "items": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "required": [ - "items" - ], - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "DateEntity": { - "type": "object", - "properties": { - "type": { - "const": "date", - "type": "string", - "description": "Exactly: date" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "options": { - "type": "object", - "description": "To specify an additional attribute for a particular type of entity, such as items for a radio bar.", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "locale": { - "type": "string", - "description": "Locale set by language and localization specifiers. Default: 'en_US', some other examples 'en-GB', 'fr-FR', 'zh-CN', 'ja-JP', 'es-ES'" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "FileEntity": { - "type": "object", - "properties": { - "type": { - "const": "file", - "type": "string", - "description": "Exactly: file" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "validators": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/StringValidator" - }, - { - "$ref": "#/definitions/RegexValidator" - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "maxFileSize": { - "type": "number", - "default": 500, - "description": "It sets the maximum file size in KB that a user can upload." - }, - "fileSupportMessage": { - "type": "string", - "description": "It displays a message inside a file component." - }, - "supportedFileTypes": { - "type": "array", - "description": "It is a list of the file types that the user can upload.", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "useBase64Encoding": { - "type": "boolean", - "default": false, - "description": "It defines used encoding for files. If true base64 will be used, if false utf-8 is applied." - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - } - }, - "required": [ - "field", - "label", - "type" - ], - "additionalProperties": false - }, - "OAuthEntity": { - "type": "object", - "properties": { - "type": { - "const": "oauth", - "type": "string", - "description": "Exactly: oauth" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "type": "boolean", - "description": "Specifies whether the field is required or not.", - "default": true - }, - "encrypted": { - "type": "boolean", - "description": "Should be true if the user wants that particular field encrypted, otherwise, there is no need to have this parameter.", - "default": false - }, - "options": { - "type": "object", - "properties": { - "display": { - "$ref": "#/definitions/display" - }, - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "requiredWhenVisible": { - "$ref": "#/definitions/requiredWhenVisible" - }, - "enable": { - "$ref": "#/definitions/enable" - }, - "auth_type": { - "type": "array", - "items": { - "anyOf": [ - { - "const": "basic", - "type": "string", - "description": "Exactly: basic" - }, - { - "const": "oauth", - "type": "string", - "description": "Exactly: oauth" - }, - { - "const": "oauth_client_credentials", - "type": "string", - "description": "Exactly: oauth_client_credentials" - }, - { - "type": "string", - "description": "Any different value that is not one of the above will be treated as a custom auth type." - } - ] - }, - "additionalProperties": false - }, - "oauth_type_labels": { - "type": "object", - "description": "It is used to set the label for each authentication type in the auth_type dropdown.", - "properties": { - "basic": { - "type": "string", - "default": "Basic Authentication", - "description": "Label for Basic Authentication type." - }, - "oauth": { - "type": "string", - "default": "OAuth 2.0 with Authorization Code Grant (interactive)", - "description": "Label for OAuth 2.0 with Authorization Code Grant (interactive) authentication type." - }, - "oauth_client_credentials": { - "type": "string", - "default": "OAuth 2.0 with Client Credentials Grant (non-interactive)", - "description": "Label for OAuth 2.0 with Client Credentials Grant (non-interactive) authentication type." - } - }, - "additionalProperties": true - }, - "basic": { - "type": "array", - "description": "Must be present only if the auth_type is [“basic”]. Will have a list of fields for you to add in the basic authentication flow.", - "items": { - "$ref": "#/definitions/OAuthFields" - } - }, - "oauth": { - "type": "array", - "description": "OAuth 2.0 with Authorization Code Grant (interactive). Will have a list of fields for you to add in the oauth authentication flow.", - "items": { - "$ref": "#/definitions/OAuthFields" - } - }, - "oauth_client_credentials": { - "type": "array", - "description": "OAuth 2.0 with Client Credentials Grant (non-interactive). Will have a list of fields for you to add in the oauth authentication flow.", - "items": { - "$ref": "#/definitions/OAuthFields" - } - }, - "auth_label": { - "type": "string", - "maxLength": 250, - "description": "Allows the user to have the custom label for the Auth Type dropdown." - }, - "oauth_popup_width": { - "type": "number", - "default": 600, - "description": "Width in pixels of the pop-up window that will open for oauth authentication" - }, - "oauth_popup_height": { - "type": "number", - "default": 600, - "description": "Height in pixels of the pop-up window that will open for oauth authentication" - }, - "oauth_timeout": { - "type": "number", - "description": "Timeout in seconds for oauth authentication ", - "default": 180 - }, - "auth_code_endpoint": { - "type": "string", - "maxLength": 350, - "description": "Must be present and its value should be the endpoint value for getting the auth_code using the app." - }, - "access_token_endpoint": { - "type": "string", - "maxLength": 350, - "description": "Must be present and its value should be the endpoint value for getting the access_token using the auth_code received." - }, - "auth_endpoint_token_access_type": { - "type": "string", - "maxLength": 350, - "description": "Optional parameter that is mapped into the value of the token_access_type query param in the authorization url." - }, - "oauth_state_enabled": { - "type": "boolean", - "default": false, - "description": "Used to include the state for oauth authentication" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "additionalProperties": true - }, - "allOf": [ - { - "if": { - "properties": { - "auth_type": { - "type": "array", - "contains": { - "const": "basic", - "type": "string", - "description": "Exactly: basic" - } - } - } - }, - "then": { - "required": [ - "basic" - ] - } - }, - { - "if": { - "properties": { - "auth_type": { - "type": "array", - "contains": { - "const": "oauth", - "type": "string", - "description": "Exactly: oauth" - } - } - } - }, - "then": { - "required": [ - "oauth" - ] - } - } - ], - "required": [ - "auth_type" - ] - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "CustomComponent": { - "type": "object", - "properties": { - "type": { - "const": "external", - "type": "string", - "description": "Exactly: external" - }, - "src": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "type", - "src" - ] - }, - "Hook": { - "description": "It is used to add custom behaviour to forms. Visit the Custom Hook page to learn more.", - "$ref": "#/definitions/CustomComponent" - }, - "CustomRow": { - "description": "Used to customise the moreInfo Component.", - "$ref": "#/definitions/CustomComponent" - }, - "CustomCell": { - "description": "Used to modify the default cell values.", - "$ref": "#/definitions/CustomComponent" - }, - "CustomEntity": { - "type": "object", - "properties": { - "type": { - "const": "custom", - "type": "string", - "description": "Exactly: custom" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "defaultValue": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ], - "description": "The initial input value." - }, - "options": { - "$ref": "#/definitions/CustomComponent" - } - }, - "required": [ - "field", - "label", - "type", - "options" - ], - "additionalProperties": false - }, - "AnyOfEntity": { - "type": "array", - "description": "It is a list of fields and their properties.", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/CheckboxGroupEntity" - }, - { - "$ref": "#/definitions/CheckboxTreeEntity" - }, - { - "$ref": "#/definitions/TextEntity" - }, - { - "$ref": "#/definitions/TextareaEntity" - }, - { - "$ref": "#/definitions/SingleSelectEntity" - }, - { - "$ref": "#/definitions/MultipleSelectEntity" - }, - { - "$ref": "#/definitions/CheckboxEntity" - }, - { - "$ref": "#/definitions/DateEntity" - }, - { - "$ref": "#/definitions/RadioEntity" - }, - { - "$ref": "#/definitions/LinkEntity" - }, - { - "$ref": "#/definitions/FileEntity" - }, - { - "$ref": "#/definitions/OAuthEntity" - }, - { - "$ref": "#/definitions/CustomEntity" - }, - { - "$ref": "#/definitions/IntervalEntity" - }, - { - "$ref": "#/definitions/IndexEntity" - } - ] - } - }, - "AutoCompleteFields": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "$ref": "#/definitions/entityLabel" - }, - "children": { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - } - }, - "required": [ - "label", - "children" - ] - } - }, - { - "type": "array", - "description": "An array of options with a label and a value.", - "items": { - "$ref": "#/definitions/ValueLabelPair" - } - } - ] - }, - "InputsPage": { - "description": "The input page stores configuration information for data collection. Multiple inputs can be created on the Inputs page.", - "oneOf": [ - { - "$ref": "#/definitions/InputPageSingleTable" - }, - { - "$ref": "#/definitions/InputPageTablePerService" - } - ] - }, - "InputsTable": { - "type": "object", - "properties": { - "moreInfo": { - "type": "array", - "description": "Specifies the list of fields that will be displayed in row form when the user clicks the Row Expand button.", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string", - "pattern": "^\\w+$", - "description": "Used to dispaly the data in a column." - }, - "label": { - "type": "string", - "maxLength": 30, - "description": "Title of the column." - }, - "mapping": { - "type": "object", - "description": "Used to map field values to more meaningful values." - } - }, - "required": [ - "field", - "label" - ] - } - }, - "header": { - "type": "array", - "description": "Specifies the list of columns in the table.", - "items": { - "type": "object", - "properties": { - "field": { - "type": "string", - "pattern": "^\\w+$", - "description": "Name of the field where the column data will be displayed." - }, - "label": { - "type": "string", - "maxLength": 30, - "description": "Text displayed next to entity field" - }, - "mapping": { - "type": "object", - "description": "Used to map field values to more meaningful values." - }, - "customCell": { - "$ref": "#/definitions/CustomCell" - } - }, - "required": [ - "field", - "label" - ] - } - }, - "customRow": { - "$ref": "#/definitions/CustomRow" - }, - "actions": { - "type": "array", - "description": "Specifies what type of action can be performed on the stanza. The supported types are edit, clone, and delete.", - "items": { - "type": "string", - "enum": [ - "edit", - "delete", - "clone", - "search" - ] - } - } - }, - "required": [ - "header", - "actions" - ], - "description": "Displays input stanzas in a tabular format.", - "additionalProperties": false - }, - "Ipv4Validator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "ipv4", - "type": "string", - "description": "Exactly: ipv4" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "Meta": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "maxLength": 200, - "description": "Name displayed for end user." - }, - "name": { - "type": "string", - "pattern": "^(?!^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$)(?!.*\\.(tar(\\.gz)?|tgz|spl)$)[A-Za-z_.-][A-Za-z0-9_.-]*[A-Za-z0-9_-]$", - "description": "Name used for API endpoints and all code references separating separating endpoints from any other app." - }, - "restRoot": { - "type": "string", - "pattern": "^[\\w-]+$", - "description": "String used to create API endpoints." - }, - "apiVersion": { - "type": "string", - "pattern": "^(?:\\d{1,3}\\.){2}\\d{1,3}$" - }, - "version": { - "type": "string", - "description": "Build version" - }, - "schemaVersion": { - "type": "string", - "pattern": "^(?:\\d{1,3}\\.){2}\\d{1,3}$", - "description": "Version of json schema used in build process." - }, - "_uccVersion": { - "type": "string", - "description": "Version of UCC used during build process. Do not use." - }, - "hideUCCVersion": { - "type": "boolean", - "description": "Hide the label 'Made with UCC' on the Configuration page" - }, - "checkForUpdates": { - "type": "boolean", - "default": true, - "description": "Ability to configure app.conf->package.check_for_updates from globalConfig file." - }, - "defaultView": { - "type": "string", - "description": "Define which view should be loaded on TA load.", - "anyOf": [ - { - "const": "inputs" - }, - { - "const": "configuration" - }, - { - "const": "dashboard" - }, - { - "const": "search" - } - ] - }, - "os-dependentLibraries": { - "type": "array", - "description": "This feature allows you to download and unpack libraries with appropriate binaries for the indicated operating system during the build process.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the library we want to download." - }, - "version": { - "type": "string", - "description": "Specific version of the given library." - }, - "dependencies": { - "type": "boolean", - "description": "(Optional) Parameter which determines whether the --no-deps flag will be used when installing the package from pip." - }, - "platform": { - "type": "string", - "description": "Platform for downloading the specified library." - }, - "python_version": { - "type": "string", - "description": "Python version compatible with the library." - }, - "target": { - "type": "string", - "description": " Path where the selected library will be unpacked." - }, - "os": { - "description": "Name of the operating system which the library is intended for. linux/windows/darwin", - "anyOf": [ - { - "const": "linux", - "type": "string", - "description": "Exactly: linux" - }, - { - "const": "windows", - "type": "string", - "description": "Exactly: windows" - }, - { - "const": "darwin", - "type": "string", - "description": "Exactly: darwin" - } - ] - }, - "ignore_requires_python": { - "type": "boolean", - "description": "(Optional) Parameter which determines whether the --ignore-requires-python flag will be used when installing the package from pip." - } - }, - "required": [ - "name", - "version", - "platform", - "python_version", - "target", - "os" - ] - } - }, - "supportedThemes": { - "description": "This feature allows you to choose theme based on the given option i.e. light and dark", - "type": "array", - "items": { - "type": "string", - "enum": [ - "light", - "dark" - ] - } - }, - "isVisible": { - "type": "boolean", - "default": true, - "description": "Ability to configure app.conf->ui.is_visible from globalConfig file." - }, - "showFooter": { - "type": "boolean", - "default": true, - "description": "Ability to show the footer component on every page of add-on" - }, - "supportedPythonVersion":{ - "description": "This feature allows you to specify which python version your app would use.", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "displayName", - "name", - "restRoot", - "version" - ], - "description": "Metadata regarding build", - "additionalProperties": false - }, - "NumberValidator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "number", - "type": "string", - "description": "Exactly: number" - }, - "range": { - "$ref": "#/definitions/RangeValue" - }, - "isInteger": { - "type": "boolean", - "description": "Specifies if the number should be an integer (true) or can be a float (false). Default value is false.", - "default": false - } - }, - "required": [ - "type", - "range" - ], - "additionalProperties": false - }, - "RangeValue": { - "type": "array", - "description": "Range of allowed values as a two-element array [min, max].", - "items": { - "type": "number" - } - }, - "DefaultOAuthFields": { - "type": "object", - "properties": { - "label": { - "type": "string", - "maxLength": 100, - "description": "Text displayed next to entity field" - }, - "field": { - "type": "string", - "maxLength": 100, - "description": "Must keep it as in examples. It is for mandatory fields as mentioned before." - }, - "help": { - "$ref": "#/definitions/help" - }, - "encrypted": { - "$ref": "#/definitions/encrypted" - }, - "required": { - "$ref": "#/definitions/required" - }, - "defaultValue": { - "type": "string", - "description": "The initial input value." - }, - "options": { - "type": "object", - "properties": { - "disableonEdit": { - "$ref": "#/definitions/disableonEdit" - }, - "enable": { - "$ref": "#/definitions/enable" - } - }, - "additionalProperties": false - }, - "modifyFieldsOnValue": { - "$ref": "#/definitions/modifyFieldsOnValue" - }, - "validators": { - "$ref": "#/definitions/AnyValidator" - } - }, - "additionalProperties": false - }, - "OAuthFields": { - "anyOf": [ - { - "$ref": "#/definitions/DefaultOAuthFields" - }, - { - "$ref": "#/definitions/CheckboxGroupEntity" - }, - { - "$ref": "#/definitions/CheckboxTreeEntity" - }, - { - "$ref": "#/definitions/TextEntity" - }, - { - "$ref": "#/definitions/TextareaEntity" - }, - { - "$ref": "#/definitions/SingleSelectEntity" - }, - { - "$ref": "#/definitions/MultipleSelectEntity" - }, - { - "$ref": "#/definitions/CheckboxEntity" - }, - { - "$ref": "#/definitions/DateEntity" - }, - { - "$ref": "#/definitions/RadioEntity" - }, - { - "$ref": "#/definitions/LinkEntity" - }, - { - "$ref": "#/definitions/FileEntity" - } - ] - }, - "BasicAuthRequirement": { - "if": { - "properties": { - "auth_type": { - "contains": { - "const": "basic", - "type": "string", - "description": "Exactly: basic" - } - } - } - }, - "then": { - "required": [ - "basic" - ] - } - }, - "OauthRequirement": { - "if": { - "properties": { - "auth_type": { - "contains": { - "const": "oauth", - "type": "string", - "description": "Exactly: oauth" - } - } - } - }, - "then": { - "required": [ - "oauth" - ] - } - }, - "OpenApiType": { - "type": "object", - "description": "OpenAPI request or response param type.", - "oneOf": [ - { - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean" - ] - }, - "nullable": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "properties": { - "type": { - "type": "string", - "const": "array" - }, - "items": { - "$ref": "#/definitions/OpenApiType" - }, - "nullable": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "type", - "items" - ] - }, - { - "properties": { - "type": { - "type": "string", - "const": "object" - }, - "properties": { - "type": "object", - "patternProperties": { - "^[a-zA-Z0-9_]+$": { - "$ref": "#/definitions/OpenApiType" - } - } - }, - "required": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false, - "required": [ - "type", - "properties" - ] - }, - { - "properties": { - "anyOf": { - "type": "array", - "items": { - "$ref": "#/definitions/OpenApiType" - } - }, - "nullable": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "anyOf" - ] - }, - { - "properties": { - "oneOf": { - "type": "array", - "items": { - "$ref": "#/definitions/OpenApiType" - } - }, - "nullable": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false, - "required": [ - "oneOf" - ] - } - ] - }, - "RestHandlerActionParams": { - "type": "object", - "description": "Request or response parameters for a particular action.", - "additionalProperties": false, - "patternProperties": { - "^[a-zA-Z0-9_]+$": { - "type": "object", - "properties": { - "required": { - "type": "boolean", - "default": false - }, - "schema": { - "$ref": "#/definitions/OpenApiType" - } - }, - "additionalProperties": false, - "required": [ - "schema" - ] - } - } - }, - "RestHandlerParams": { - "type": "object", - "description": "Request or response parameters.", - "additionalProperties": false, - "properties": { - "list": { - "$ref": "#/definitions/RestHandlerActionParams" - }, - "edit": { - "$ref": "#/definitions/RestHandlerActionParams" - }, - "create": { - "$ref": "#/definitions/RestHandlerActionParams" - }, - "remove": { - "$ref": "#/definitions/RestHandlerActionParams" - } - } - }, - "RestHandler": { - "type": "object", - "description": "Rest handlers not automatically generated by UCC.", - "properties": { - "name": { - "type": "string", - "description": "The name of the handler.", - "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$" - }, - "resourcePresent": { - "type": "boolean", - "description": "Specifies whether the collection should expose its resources as well via web.conf or not.", - "default": false - }, - "parentResource": { - "type": "string", - "description": "Specifies parentResource for the endpoint. It would be generated for match attribute in restmap.conf", - "default": "/" - }, - "capabilities": { - "$ref": "#/definitions/capabilities" - }, - "endpoint": { - "type": "string", - "description": "The endpoint for the custom rest handler.", - "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$" - }, - "handlerType": { - "type": "string", - "description": "The type of the handler.", - "enum": [ - "EAI" - ] - }, - "registerHandler": { - "type": "object", - "description": "Parameters needed to register the endpoint in web.conf and restmap.conf", - "properties": { - "file": { - "type": "string", - "description": "The file where the custom rest handler is located.", - "pattern": "^[a-zA-Z0-9_]+\\.py$" - }, - "actions": { - "type": "array", - "description": "The actions that the custom rest handler supports.", - "items": { - "type": "string", - "description": "The action that the custom rest handler supports.", - "enum": [ - "list", - "edit", - "create", - "remove" - ], - "minItems": 1, - "uniqueItems": true - } - } - }, - "additionalProperties": false, - "required": [ - "file", - "actions" - ] - }, - "requestParameters": { - "type": "object", - "description": "The parameters that the custom rest handler supports.", - "$ref": "#/definitions/RestHandlerParams" - }, - "responseParameters": { - "type": "object", - "description": "The parameters that the custom rest handler returns.", - "$ref": "#/definitions/RestHandlerParams" - } - }, - "additionalProperties": false, - "required": [ - "name", - "endpoint", - "handlerType" - ] - }, - "Options": { - "type": "object", - "description": "Additional options for the addon", - "properties": { - "restHandlers": { - "type": "array", - "items": { - "$ref": "#/definitions/RestHandler" - } - } - }, - "additionalProperties": false - }, - "Pages": { - "type": "object", - "description": "Definition of addon pages (configuration, inputs, dashboard)", - "properties": { - "configuration": { - "$ref": "#/definitions/ConfigurationPage" - }, - "inputs": { - "$ref": "#/definitions/InputsPage" - }, - "dashboard": { - "$ref": "#/definitions/DashboardPage" - } - }, - "additionalProperties": false - }, - "RegexValidator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "regex", - "type": "string", - "description": "Exactly: regex" - }, - "pattern": { - "type": "string", - "description": "Regular expression pattern to validate against." - } - }, - "required": [ - "type", - "pattern" - ], - "additionalProperties": false - }, - "StringValidator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "string", - "type": "string", - "description": "Exactly: string" - }, - "minLength": { - "type": "number", - "minimum": 0, - "description": "Specifies the minimum number of characters allowed." - }, - "maxLength": { - "type": "number", - "minimum": 0, - "description": "Specifies the maximum number of characters allowed." - } - }, - "required": [ - "type", - "minLength", - "maxLength" - ], - "additionalProperties": false - }, - "TabContent": { - "type": "object", - "description": "Content for separated Tab", - "properties": { - "entity": { - "$ref": "#/definitions/AnyOfEntity" - }, - "name": { - "type": "string", - "description": "Tab identificator", - "pattern": "^[\\/\\w]+$", - "maxLength": 250 - }, - "title": { - "type": "string", - "description": "Displayed title", - "maxLength": 50 - }, - "options": { - "$ref": "#/definitions/SaveValidatorHook" - }, - "table": { - "$ref": "#/definitions/ConfigurationTable" - }, - "style": { - "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", - "type": "string", - "enum": [ - "page", - "dialog" - ] - }, - "conf": { - "type": "string", - "maxLength": 100, - "description": "Configuration name for a rest handler." - }, - "restHandlerName": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Handler name that extends the default behaviour of the UCC-generated REST handlers. (Do NOT use with restHandlerModule) " - }, - "restHandlerModule": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Module name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerClass) " - }, - "restHandlerClass": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Class name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerModule)" - }, - "hook": { - "$ref": "#/definitions/Hook" - }, - "customTab": { - "description": "This property allows you to enable the custom tab feature.", - "$ref": "#/definitions/CustomComponent" - }, - "warning": { - "$ref": "#/definitions/WarningMessage" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "groups": { - "$ref": "#/definitions/Groups" - }, - "formTitle": { - "type": "string", - "maxLength": 100, - "description": "Custom modal title that replaces the default 'Add selectedTab' text. When specified, the modal will display 'Add' followed by the formTitle value" - } - }, - "anyOf": [ - { - "required": [ - "entity", - "name", - "title" - ] - }, - { - "required": [ - "customTab", - "name", - "title" - ] - } - ], - "additionalProperties": false - }, - "Technology": { - "type": "object", - "description": "Defines the technology or technologies that the modular action supports.", - "properties": { - "version": { - "type": "array", - "items": { - "type": "string", - "pattern": "^\\d+(?:\\.\\d+)*$" - }, - "minItems": 1, - "description": "Array of supported version numbers." - }, - "product": { - "type": "string", - "maxLength": 100, - "description": "Name of the product or technology." - }, - "vendor": { - "type": "string", - "maxLength": 100, - "description": "Name of the vendor or organization." - } - }, - "required": [ - "version", - "product", - "vendor" - ], - "additionalProperties": false - }, - "UrlValidator": { - "type": "object", - "properties": { - "errorMsg": { - "$ref": "#/definitions/errorMsg" - }, - "type": { - "const": "url", - "type": "string", - "description": "Exactly: url" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "AnyValidator": { - "type": "array", - "description": "It is used to validate the values of fields using various validators.", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/NumberValidator" - }, - { - "$ref": "#/definitions/StringValidator" - }, - { - "$ref": "#/definitions/RegexValidator" - }, - { - "$ref": "#/definitions/EmailValidator" - }, - { - "$ref": "#/definitions/Ipv4Validator" - }, - { - "$ref": "#/definitions/UrlValidator" - }, - { - "$ref": "#/definitions/DateValidator" - } - ] - } - }, - "ValueLabelPair": { - "type": "object", - "description": "Option item with a display label and corresponding value for form controls.", - "properties": { - "value": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string", - "maxLength": 250 - }, - { - "type": "boolean" - } - ], - "description": "The actual value to be stored when this option is selected." - }, - "label": { - "type": "string", - "maxLength": 100, - "description": "Text displayed to the user for this option." - } - }, - "required": [ - "label" - ], - "additionalProperties": false - }, - "DashboardPanel": { - "type": "object", - "description": "Dashboard panel that provides operational insights and monitoring information for the add-on.", - "properties": { - "name": { - "type": "string", - "maxLength": 100, - "description": "Identifier for the dashboard panel" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - }, - "WarningMessage": { - "type": "object", - "description": "It is used to add the custom warning message for each of the modes of ‘create’, ‘edit’, ‘config’, and ‘clone’. The message is displayed on the form.", - "properties": { - "create": { - "$ref": "#/definitions/WarningMessageObject" - }, - "edit": { - "$ref": "#/definitions/WarningMessageObject" - }, - "clone": { - "$ref": "#/definitions/WarningMessageObject" - }, - "config": { - "$ref": "#/definitions/WarningMessageObject" - } - }, - "additionalProperties": false - }, - "WarningMessageObject": { - "type": "object", - "description": "Object for individual warning messages displayed in forms.", - "properties": { - "message": { - "type": "string", - "description": "Text content of the warning message. Use \\n to add line breaks.", - "maxLength": 500 - }, - "alwaysDisplay": { - "type": "boolean", - "default": false, - "description": "When true, the message remains visible even after user input changes. When false, the message disappears after any input modification." - } - }, - "required": [ - "message" - ] - }, - "Field": { - "type": "string", - "description": "Unique identifier for an input field used in forms and data handling.", - "pattern": "(?!^(?:persistentQueueSize|queueSize|start_by_shell|output_mode|output_field|owner|app|sharing)$)(?:^\\w+$)" - }, - "SubDescription": { - "type": "object", - "description": "Extended description section that provides detailed information about a page or section with optional embedded links.", - "properties": { - "text": { - "type": "string", - "description": "Main description text. Use \\n to add line breaks.", - "maxLength": 1500 - }, - "links": { - "$ref": "#/definitions/links" - } - }, - "required": [ - "text" - ] - }, - "capabilities": { - "type": "object", - "description": "Define capabilities for the users", - "properties": { - "put": { - "type": "string", - "description": "Define capability when PUT method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" - }, - "delete": { - "type": "string", - "description": "Define capability when DELETE method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" - }, - "post": { - "type": "string", - "description": "Define capability when POST method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" - }, - "get": { - "type": "string", - "description": "Define capability when GET method will be executed. For more information visit Splunk doc : https://docs.splunk.com/Documentation/Splunk/latest/Admin/restmapconf#restmap.conf.spec" - } - } - }, - "singleFieldToModify": { - "type": "object", - "description": "Configuration for modifying a specific field's properties based on another field's value.", - "properties": { - "fieldId": { - "type": "string", - "description": "Identifier of the field to be modified when the trigger condition is met." - }, - "display": { - "type": "boolean", - "description": "Controls whether the target field is visible (true) or hidden (false)." - }, - "value": { - "description": "Sets the value of the target field when the trigger condition is met.", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ] - }, - "disabled": { - "type": "boolean", - "description": "Controls whether the target field is disabled (true) or enabled (false)." - }, - "required": { - "type": "boolean", - "description": "Controls whether the target field is required (true) or optional (false)." - }, - "help": { - "$ref": "#/definitions/help" - }, - "label": { - "type": "string", - "description": "Sets the display label text for the target field." - }, - "markdownMessage": { - "$ref": "#/definitions/markdownMessage" - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - } - }, - "required": [ - "fieldId" - ] - }, - "links": { - "type": "array", - "description": "Array of link definitions that can be embedded within description text using placeholder slugs.", - "items": { - "type": "object", - "properties": { - "slug": { - "type": "string", - "description": "Unique identifier used as a placeholder in text. Surround with double square brackets [[slug]] in the text to create the link.", - "maxLength": 50, - "pattern": "^\\w+$", - "minLength": 1 - }, - "linkText": { - "type": "string", - "description": "Display text for the link that replaces the slug placeholder.", - "maxLength": 500, - "minLength": 1 - }, - "link": { - "description": "URL or path destination for the link.", - "type": "string", - "minLength": 1 - } - }, - "required": [ - "slug", - "linkText", - "link" - ] - } - }, - "fieldToModify": { - "type": "object", - "description": "Defines a trigger condition and the resulting field modifications when that condition is met.", - "properties": { - "fieldValue": { - "description": "Trigger value that activates the field modifications. Use [[any_other_value]] to trigger for any value other than explicitly specified ones.", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "type": "object", - "properties": { - "pattern": { - "type": "string", - "description": "Regex pattern that will be used to match against component value" - } - } - } - ] - }, - "mode": { - "type": "string", - "description": "Restricts modifications to a specific form mode. If omitted, modifications apply to all modes.", - "enum": [ - "create", - "edit", - "config", - "clone" - ] - }, - "fieldsToModify": { - "type": "array", - "description": "Array of field modifications to apply when the trigger condition is met.", - "items": { - "$ref": "#/definitions/singleFieldToModify" - }, - "minItems": 1 - } - }, - "required": [ - "fieldValue", - "fieldsToModify" - ] - }, - "modifyFieldsOnValue": { - "type": "array", - "description": "Dynamic field modification system that changes field properties based on the current value of the parent field.", - "items": { - "$ref": "#/definitions/fieldToModify" - } - }, - "markdownMessageText": { - "type": "object", - "properties": { - "markdownType": { - "const": "text", - "type": "string", - "description": "Exactly: text" - }, - "text": { - "type": "string", - "description": "Declare message content" - }, - "color": { - "type": "string", - "description": "Specify color of displayied text. Accepts all CSS colors" - } - }, - "required": [ - "markdownType", - "text" - ] - }, - "markdownMessageHybrid": { - "type": "object", - "properties": { - "markdownType": { - "const": "hybrid", - "type": "string", - "description": "Exactly: hybrid" - }, - "text": { - "type": "string", - "description": "Declare message content" - }, - "token": { - "type": "string", - "description": "Declare string that will be swapped into link" - }, - "linkText": { - "type": "string", - "description": "Declare string that will put in place of token" - }, - "link": { - "type": "string", - "description": "Declare url that will use for redirection" - } - }, - "required": [ - "markdownType", - "text", - "token", - "link", - "linkText" - ] - }, - "markdownMessageLink": { - "type": "object", - "properties": { - "markdownType": { - "const": "link", - "type": "string", - "description": "Exactly: link" - }, - "text": { - "type": "string", - "description": "Declare message content" - }, - "link": { - "type": "string", - "description": "Declare url used for redirection" - } - }, - "required": [ - "markdownType", - "text", - "link" - ] - }, - "markdownMessagePlainText": { - "type": "object", - "properties": { - "text": { - "type": "string", - "description": "Declare message content" - } - }, - "required": [ - "text" - ] - }, - "markdownMessage": { - "description": "Message that will be displayed as additional information", - "anyOf": [ - { - "$ref": "#/definitions/markdownMessageText" - }, - { - "$ref": "#/definitions/markdownMessageHybrid" - }, - { - "$ref": "#/definitions/markdownMessageLink" - }, - { - "$ref": "#/definitions/markdownMessagePlainText" - } - ] - }, - "PredefinedLoggingTab": { - "type": "object", - "description": "Predefined Logging tab configuration, can be used to reduce length of config", - "properties": { - "type": { - "type": "string", - "const": "loggingTab", - "description": "Exactly: loggingTab" - }, - "name": { - "type": "string", - "pattern": "^[\\/\\w]+$", - "default": "Logging", - "description": "Tab name.", - "maxLength": 250 - }, - "title": { - "type": "string", - "default": "Logging", - "description": "Tab title.", - "maxLength": 50 - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "field": { - "$ref": "#/definitions/Field", - "default": "loglevel" - }, - "levels": { - "type": "array", - "default": [ - "DEBUG", - "INFO", - "WARNING", - "ERROR", - "CRITICAL" - ], - "description": "List of all possible log levels.", - "items": { - "type": "string" - } - }, - "defaultLevel": { - "type": "string", - "default": "INFO", - "description": "Default log level at the beginning." - }, - "help": { - "$ref": "#/definitions/help" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "PredefinedProxyTab": { - "type": "object", - "description": "Predefined Proxy tab configuration, can be used to reduce length of config", - "properties": { - "type": { - "type": "string", - "const": "proxyTab", - "description": "Exactly: proxyTab" - }, - "name": { - "type": "string", - "pattern": "^[\\/\\w]+$", - "default": "Proxy", - "description": "Tab name.", - "maxLength": 250 - }, - "title": { - "type": "string", - "default": "Proxy", - "description": "Tab title.", - "maxLength": 50 - }, - "enable_proxy": { - "type": "object", - "default": { - "type": "checkbox", - "label": "Enable", - "field": "proxy_enabled" - }, - "description": "Checkbox for enabling proxy" - }, - "proxy_type": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "default": { - "type": "singleSelect", - "label": "Proxy Type", - "required": false, - "options": { - "disableSearch": true, - "autoCompleteFields": [ - { - "value": "http", - "label": "http" - }, - { - "value": "socks4", - "label": "socks4" - }, - { - "value": "socks5", - "label": "socks5" - } - ] - }, - "defaultValue": "http", - "field": "proxy_type" - } - } - ], - "description": "Proxy type. Available values: http, socks4, socks5" - }, - "host": { - "type": "object", - "default": { - "type": "text", - "label": "Host", - "validators": [ - { - "type": "string", - "errorMsg": "Max host length is 4096", - "minLength": 0, - "maxLength": 4096 - }, - { - "type": "regex", - "errorMsg": "Proxy Host should not have special characters", - "pattern": "^[a-zA-Z]\\w*$" - } - ], - "field": "proxy_url" - }, - "description": "Host of the proxy" - }, - "port": { - "type": "object", - "default": { - "type": "text", - "label": "Port", - "validators": [ - { - "type": "number", - "range": [ - 1, - 65535 - ], - "isInteger": true - } - ], - "field": "proxy_port" - }, - "description": "Port of the proxy" - }, - "username": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "default": { - "type": "text", - "label": "Username", - "validators": [ - { - "type": "string", - "errorMsg": "Max length of username is 50", - "minLength": 0, - "maxLength": 50 - } - ], - "field": "proxy_username" - } - } - ], - "description": "Username used to access the proxy server." - }, - "password": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "default": { - "type": "text", - "label": "Password", - "validators": [ - { - "type": "string", - "errorMsg": "Max length of password is 8192", - "minLength": 0, - "maxLength": 8192 - } - ], - "encrypted": true, - "field": "proxy_password" - } - } - ], - "description": "Password assigned for the username" - }, - "dns_resolution": { - "oneOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "default": { - "type": "checkbox", - "label": "DNS resolution", - "field": "proxy_rdns" - } - } - ], - "description": "Specifies whether DNS resolution should be used or not." - }, - "options": { - "$ref": "#/definitions/SaveValidatorHook" - }, - "hook": { - "$ref": "#/definitions/Hook" - }, - "warning": { - "$ref": "#/definitions/WarningMessage" - }, - "help": { - "$ref": "#/definitions/help" - } - }, - "required": [ - "type" - ], - "additionalProperties": false - }, - "InputPageSingleTable": { - "type": "object", - "properties": { - "title": { - "type": "string", - "maxLength": 60, - "description": "Title of Input Page" - }, - "description": { - "description": "It provides a brief summary of an inputs page.", - "type": "string", - "maxLength": 200 - }, - "subDescription": { - "$ref": "#/definitions/SubDescription" - }, - "table": { - "$ref": "#/definitions/InputsTable" - }, - "groupsMenu": { - "type": "array", - "description": "This property allows you to enable the multi-level menu feature.", - "items": { - "type": "object", - "properties": { - "groupName": { - "type": "string", - "pattern": "^[0-9a-zA-Z][\\w-]*$", - "maxLength": 50, - "description": "id of group that will be used for group association." - }, - "groupTitle": { - "type": "string", - "maxLength": 100, - "description": "Name of group that will be displayed inside menu." - }, - "groupServices": { - "type": "array", - "description": "List of services that is inside group.", - "items": { - "type": "string", - "description": "Name of the service.", - "pattern": "^[0-9a-zA-Z][\\w-]*$", - "maxLength": 50 - } - } - }, - "required": [ - "groupTitle", - "groupName" - ] - } - }, - "services": { - "type": "array", - "description": "It specifies a list of modular inputs.", - "items": { - "type": "object", - "properties": { - "name": { - "description": "It defines the particular service name.", - "type": "string", - "pattern": "^[0-9a-zA-Z][\\w-]*$", - "maxLength": 50 - }, - "title": { - "description": "It shows the title of the service.", - "type": "string", - "maxLength": 100 - }, - "subTitle": { - "description": "It shows the subtitle (or additional information) of the service.", - "type": "string", - "maxLength": 50 - }, - "entity": { - "$ref": "#/definitions/AnyOfEntity" - }, - "options": { - "$ref": "#/definitions/SaveValidatorHook" - }, - "groups": { - "$ref": "#/definitions/Groups" - }, - "style": { - "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", - "type": "string", - "enum": [ - "page", - "dialog" - ] - }, - "hook": { - "$ref": "#/definitions/Hook" - }, - "conf": { - "type": "string", - "maxLength": 100, - "description": "Configuration name for a rest handler." - }, - "restHandlerName": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Handler name that extends the default behaviour of the UCC-generated REST handlers. (Do NOT use with restHandlerModule) " - }, - "restHandlerModule": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Module name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerClass) " - }, - "restHandlerClass": { - "type": "string", - "maxLength": 100, - "description": "Specify rest Class name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerModule)" - }, - "inputHelperModule": { - "type": "string", - "maxLength": 100, - "description": "A module that contains `validate_input` and `stream_events` methods. By default it is not used." - }, - "warning": { - "$ref": "#/definitions/WarningMessage" - }, - "disableNewInput": { - "type": "boolean", - "description": "Defines whether a newly created input of a service should be disabled by default.", - "default": false - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "formTitle": { - "type": "string", - "maxLength": 100, - "description": "Custom modal title that replaces the default 'Add inputname' text in the header. When specified, the header will display 'Add' followed by the formTitle value" - } - }, - "not": { - "required": [ - "table" - ] - }, - "required": [ - "name", - "title", - "entity" - ] - } - }, - "hideFieldId": { - "type": "string" - }, - "readonlyFieldId": { - "type": "string" - }, - "useInputToggleConfirmation": { - "$ref": "#/definitions/useInputToggleConfirmation" - }, - "inputsUniqueAcrossSingleService": { - "$ref": "#/definitions/inputsUniqueAcrossSingleService" - }, - "capabilities": { - "$ref": "#/definitions/capabilities" - } - }, - "required": [ - "title", - "table", - "services" - ], - "description": "Input Page definition where there is only one single tabel listing all services.", - "additionalProperties": false - }, - "InputPageTablePerService": { - "type": "object", - "properties": { - "title": { - "type": "string", - "maxLength": 60, - "description": "Title of Input Page" - }, - "services": { - "description": "Specifies a list of modular inputs.", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "It defines the particular service name.", - "pattern": "^[0-9a-zA-Z][0-9a-zA-Z_-]*$", - "maxLength": 50 - }, - "title": { - "description": "It shows the title of the service.", - "type": "string", - "maxLength": 100 - }, - "subTitle": { - "type": "string", - "description": "It shows the subtitle (or additional information) of the service.", - "maxLength": 50 - }, - "description": { - "type": "string", - "maxLength": 200 - }, - "table": { - "$ref": "#/definitions/InputsTable" - }, - "useInputToggleConfirmation": { - "$ref": "#/definitions/useInputToggleConfirmation" - }, - "entity": { - "$ref": "#/definitions/AnyOfEntity" - }, - "options": { - "$ref": "#/definitions/SaveValidatorHook" - }, - "groups": { - "$ref": "#/definitions/Groups" - }, - "style": { - "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", - "type": "string", - "enum": [ - "page", - "dialog" - ] - }, - "hook": { - "$ref": "#/definitions/Hook" - }, - "conf": { - "type": "string", - "maxLength": 100 - }, - "restHandlerName": { - "type": "string", - "maxLength": 100 - }, - "restHandlerModule": { - "type": "string", - "maxLength": 100 - }, - "restHandlerClass": { - "type": "string", - "maxLength": 100 - }, - "inputHelperModule": { - "type": "string", - "maxLength": 100 - } - }, - "required": [ - "name", - "title", - "table", - "entity" - ] - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "formTitle": { - "type": "string", - "maxLength": 100, - "description": "Custom modal title that replaces the default 'Add selectedInputTab' text in the header. When specified, the header will display 'Add' followed by the formTitle value" - } - }, - "hideFieldId": { - "type": "string" - }, - "readonlyFieldId": { - "type": "string" - }, - "inputsUniqueAcrossSingleService": { - "$ref": "#/definitions/inputsUniqueAcrossSingleService" - }, - "capabilities": { - "$ref": "#/definitions/capabilities" - } - }, - "required": [ - "title", - "services" - ], - "description": "Input Page definition where there are tabs for each service with separate table listing input service entries.", - "additionalProperties": false - }, - "errorMsg": { - "type": "string", - "description": "Custom error message.", - "maxLength": 400 - }, - "help": { - "anyOf": [ - { - "type": "string", - "description": "Help text gives context about a fields input, such as how the input will be used. It is displayed directly below an input field." - }, - { - "$ref": "#/definitions/helpWithLinks" - } - ] - }, - "helpWithLinks": { - "type": "object", - "description": "Property to provide structured help message", - "properties": { - "text": { - "type": "string", - "description": "Text used for the help message, you can put \n to add a breakline." - }, - "links": { - "$ref": "#/definitions/links" - }, - "link": { - "type": "string" - } - }, - "required": [ - "text" - ] - }, - "tooltip": { - "type": "string", - "description": "Displays a tooltip beside the label." - }, - "required": { - "type": "boolean", - "description": "To specify whether the field is required or not.", - "default": false - }, - "encrypted": { - "type": "boolean", - "description": "To encrypt that particular field.", - "default": false - }, - "display": { - "type": "boolean", - "description": "It chooses whether or not to display the field.", - "default": true - }, - "hideForPlatform": { - "$ref": "#/definitions/HideForPlatform" - }, - "disableonEdit": { - "type": "boolean", - "description": "When the form is in edit mode, the field becomes unable to be edited.", - "default": false - }, - "enable": { - "type": "boolean", - "description": "The enable property sets whether a field is enabled or not.", - "default": true - }, - "requiredWhenVisible": { - "type": "boolean", - "description": "It makes the field required on the UI when it appears. It is used only for visibility.", - "default": false - }, - "entityLabel": { - "type": "string", - "description": "Text displayed next to entity field" - }, - "useInputToggleConfirmation": { - "type": "boolean", - "description": "When true displays additional confirmation modal when toggling single input status.", - "default": false - }, - "IntervalEntity": { - "type": "object", - "properties": { - "type": { - "const": "interval", - "description": "Exactly: interval" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "$ref": "#/definitions/entityLabel" - }, - "defaultValue": { - "$ref": "#/definitions/IntervalValue" - }, - "options": { - "type": "object", - "properties": { - "range": { - "$ref": "#/definitions/RangeValue" - } - }, - "additionalProperties": false, - "required": [ - "range" - ] - }, - "help": { - "$ref": "#/definitions/help" - }, - "tooltip": { - "$ref": "#/definitions/tooltip" - }, - "required": { - "$ref": "#/definitions/required" - } - }, - "required": [ - "type", - "field", - "label" - ], - "additionalProperties": false - }, - "HideForPlatform": { - "description": "Defines for which platform element should be hidden from UI perspective.", - "anyOf": [ - { - "const": "cloud" - }, - { - "const": "enterprise" - } - ] - }, - "inputsUniqueAcrossSingleService": { - "description": "Defines if inputs in different services can share same name.", - "type": "boolean", - "default": false - }, - "IntervalValue": { - "description": "Valid interval values: -1, positive numbers (seconds), or CRON expressions for scheduling.", - "anyOf": [ - { - "type": "number", - "const": -1 - }, - { - "type": "number", - "minimum": 0 - }, - { - "type": "string", - "pattern": "^((?:-1|\\d+(?:\\.\\d+)?)|(([\\*\\d{1,2}\\,\\-\\/]+\\s){4}[\\*\\d{1,2}\\,\\-\\/]+))$" - } - ] - }, - "IndexEntity": { - "type": "object", - "description": "Index selection component that provides a dropdown of available Splunk indexes with built-in validation.", - "properties": { - "type": { - "const": "index" - }, - "field": { - "$ref": "#/definitions/Field" - }, - "label": { - "type": "string", - "description": "Display label for the index selection field." - }, - "defaultValue": { - "type": "string", - "description": "Default index to select when the form loads." - }, - "help": { - "$ref": "#/definitions/help" - }, - "required": { - "$ref": "#/definitions/required" - } - }, - "required": [ - "type", - "field", - "label" - ], - "additionalProperties": false - } - }, + "$id": "schema.json", "type": "object", "properties": { "meta": { - "$ref": "#/definitions/Meta" + "$ref": "./subschema/meta.json" }, "pages": { - "$ref": "#/definitions/Pages" + "$ref": "./subschema/Pages/pages.json" }, "alerts": { "type": "array", "description": "Alerts configuration. The alert action can help a user to take action on the alerts that have been triggered. The knowledge from Splunk can be sent to an outside service or to pull additional or detailed information related to the trigger details.", "items": { - "$ref": "#/definitions/Alerts" + "$ref": "./subschema/Alerts/alerts.json" }, "minItems": 1 }, @@ -4460,12 +21,12 @@ "type": "array", "description": "Configuration for custom search commands that extend Splunk's search capabilities with add-on specific functionality.", "items": { - "$ref": "#/definitions/customSearchCommand" + "$ref": "./subschema/customSearchCommand.json" }, "minItems": 1 }, "options": { - "$ref": "#/definitions/Options" + "$ref": "./subschema/options.json" } }, "required": [ diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertCheckboxEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertCheckboxEntity.json new file mode 100644 index 0000000000..d211e5a092 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertCheckboxEntity.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertCheckboxEntity.json", + "title": "AlertCheckboxEntity", + "type": "object", + "properties": { + "type": { + "const": "checkbox", + "type": "string", + "description": "Exactly: checkbox" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity Field" + }, + "defaultValue": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number" + } + ], + "description": "The initial input value." + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertRadioEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertRadioEntity.json new file mode 100644 index 0000000000..26303ed305 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertRadioEntity.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertRadioEntity.json", + "title": "AlertRadioEntity", + "type": "object", + "properties": { + "type": { + "const": "radio", + "type": "string", + "description": "Exactly: radio" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "defaultValue": { + "description": "The initial input value.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + }, + "options": { + "type": "object", + "description": "Static choices that a user can select in the alert action UI.", + "properties": { + "items": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "../../common/common.json#/definitions/ValueLabelPair" + } + } + } + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectEntity.json new file mode 100644 index 0000000000..e4add7bbe7 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectEntity.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertSingleSelectEntity.json", + "title": "AlertSingleSelectEntity", + "type": "object", + "properties": { + "type": { + "const": "singleSelect", + "type": "string", + "description": "Exactly: singleSelect" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "defaultValue": { + "description": "The initial input value.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + }, + "options": { + "type": "object", + "description": "Static choices that a user can select in the alert action UI.", + "properties": { + "items": { + "type": "array", + "description": "An array of options with a label and a value.", + "items": { + "$ref": "../../common/common.json#/definitions/ValueLabelPair" + } + } + } + } + }, + "required": [ + "field", + "label", + "type", + "options" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectSplunkSearchEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectSplunkSearchEntity.json new file mode 100644 index 0000000000..b9018a94bc --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertSingleSelectSplunkSearchEntity.json @@ -0,0 +1,86 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertSingleSelectSplunkSearchEntity.json", + "title": "AlertSingleSelectSplunkSearchEntity", + "type": "object", + "description": "Alerts configuration. The alert action can help a user to take action on the alerts that have been triggered. The knowledge from Splunk can be sent to an outside service or to pull additional or detailed information related to the trigger details.", + "properties": { + "field": { + "type": "string", + "pattern": "^\\w+$", + "description": "Field identifier used in scripts to access the user input value. Referenced as param. in alert_actions.conf." + }, + "label": { + "type": "string", + "maxLength": 30, + "description": "Display text shown in the alert action user interface." + }, + "type": { + "const": "singleSelectSplunkSearch", + "type": "string", + "description": "Exactly: singleSelectSplunkSearch" + }, + "help": { + "type": "string", + "maxLength": 200, + "description": "Help text displayed under the field to provide context about the field's usage." + }, + "defaultValue": { + "description": "The initial input value.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string", + "maxLength": 250 + }, + { + "type": "boolean" + } + ] + }, + "required": { + "type": "boolean", + "default": false, + "description": "Specifies whether the field is required or not." + }, + "search": { + "type": "string", + "maxLength": 200, + "description": "A Splunk SPL query that returns results for the dropdown options. Can query REST API, lookup tables, or indexed data." + }, + "valueField": { + "type": "string", + "maxLength": 200, + "description": "Field name to use for dropdown option values. In some cases, you can use the same field for both label and value. In other cases, you might need human-readable labels from one field and corresponding values from another field. Note: Applicable when a search property is defined." + }, + "labelField": { + "type": "string", + "maxLength": 200, + "description": "Field name to use for dropdown option labels. Labels from this field are visible in the dropdown interface. Note: Applicable when a search property is defined." + }, + "options": { + "type": "object", + "description": "Configuration options for static dropdown choices displayed in the alert action UI.", + "properties": { + "items": { + "type": "array", + "description": "Array of predefined options with labels and values for user selection.", + "items": { + "$ref": "../../common/common.json#/definitions/ValueLabelPair" + } + } + } + } + }, + "required": [ + "field", + "label", + "type", + "search", + "valueField", + "labelField" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextAreaEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextAreaEntity.json new file mode 100644 index 0000000000..103608acc1 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextAreaEntity.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertTextAreaEntity.json", + "title": "AlertTextareaEntity", + "type": "object", + "properties": { + "type": { + "const": "textarea", + "type": "string", + "description": "Exactly: textarea" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "defaultValue": { + "type": "string", + "description": "The initial input value." + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextEntity.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextEntity.json new file mode 100644 index 0000000000..dfac274ac1 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alertTextEntity.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alertTextEntity.json", + "title": "AlertTextEntity", + "type": "object", + "properties": { + "type": { + "const": "text", + "type": "string", + "description": "Exactly: text" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field" + }, + "label": { + "type": "string", + "description": "Text displayed next to entity field" + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + }, + "defaultValue": { + "description": "The initial input value.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "required": { + "type": "boolean", + "description": "To specify whether the field is required or not.", + "default": false + } + }, + "required": [ + "field", + "label", + "type" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Alerts/alerts.json b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alerts.json new file mode 100644 index 0000000000..573090139b --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Alerts/alerts.json @@ -0,0 +1,163 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Alerts/alerts.json", + "title": "Alerts", + "type": "object", + "definitions": { + "Technology": { + "type": "object", + "description": "Defines the technology or technologies that the modular action supports.", + "properties": { + "version": { + "type": "array", + "items": { + "type": "string", + "pattern": "^\\d+(?:\\.\\d+)*$" + }, + "minItems": 1, + "description": "Array of supported version numbers." + }, + "product": { + "type": "string", + "maxLength": 100, + "description": "Name of the product or technology." + }, + "vendor": { + "type": "string", + "maxLength": 100, + "description": "Name of the vendor or organization." + } + }, + "required": [ + "version", + "product", + "vendor" + ], + "additionalProperties": false + } + }, + "description": "The alert action can help a user to take action on the alerts that have been triggered. ", + "properties": { + "name": { + "type": "string", + "pattern": "^[a-zA-Z0-9_]+$", + "maxLength": 100, + "description": "Alphanumeric name that would be used to generate the Python file for the alert action." + }, + "label": { + "type": "string", + "maxLength": 100, + "description": "User-friendly name of the alert action that would be seen in the Trigger Actions." + }, + "description": { + "type": "string", + "description": "Description of the alert action." + }, + "iconFileName": { + "type": "string", + "maxLength": 100, + "default": "alerticon.png", + "description": "The name of the icon to be shown in the Alert Action UI. It has to be present in /appserver/static/ directory." + }, + "adaptiveResponse": { + "type": "object", + "description": "Define only if the alert action will be visible for AR in Splunk Enterprise Security app. Refer documentation for complete details.", + "properties": { + "task": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "description": "The function or functions performed by the modular action." + }, + "supportsAdhoc": { + "type": "boolean", + "default": false, + "description": "Specifies if the modular action supports adhoc invocations." + }, + "supportsCloud": { + "type": "boolean", + "default": true, + "description": "Specifies if the modular actions supports the “cloud” model." + }, + "subject": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "description": "The object or objects that the modular action’s task(s) can be performed on (i.e. “endpoint.file”)." + }, + "category": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "description": "The category or categories the modular action belongs to." + }, + "technology": { + "type": "array", + "items": { + "$ref": "#/definitions/Technology" + }, + "minItems": 1, + "description": "The technology or technologies that the modular action supports." + }, + "drilldownUri": { + "type": "string", + "description": "Specifies a custom target for viewing the events outputted as a result of the action. Custom target can specify app and/or view depending on syntax." + }, + "sourcetype": { + "type": "string", + "pattern": "^[a-zA-Z0-9:-_]+$", + "maxLength": 50, + "description": "The sourcetype in which the result of the AR alert action would be written to. The value is updated in the alert action script. If you don’t specify any value you can update your alert action script manually once it is generated." + } + }, + "required": [ + "task", + "subject", + "category", + "technology" + ] + }, + "entity": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "./alertTextEntity.json" + }, + { + "$ref": "./alertTextAreaEntity.json" + }, + { + "$ref": "./alertCheckboxEntity.json" + }, + { + "$ref": "./alertSingleSelectEntity.json" + }, + { + "$ref": "./alertRadioEntity.json" + }, + { + "$ref": "./alertSingleSelectSplunkSearchEntity.json" + } + ] + } + }, + "customScript": { + "type": "string", + "maxLength": 100, + "description": "A Python script that would have validation and logic for alert action execution. The script should be present at /bin/. Refer documentation for more information." + } + }, + "required": [ + "name", + "label", + "description" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Pages/configuration.json b/splunk_add_on_ucc_framework/schema/subschema/Pages/configuration.json new file mode 100644 index 0000000000..120cc235de --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Pages/configuration.json @@ -0,0 +1,472 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Pages/configuration.json", + "title": "ConfigurationPage", + "type": "object", + "definitions": { + "PredefinedLoggingTab": { + "type": "object", + "description": "Predefined Logging tab configuration, can be used to reduce length of config", + "properties": { + "type": { + "type": "string", + "const": "loggingTab", + "description": "Exactly: loggingTab" + }, + "name": { + "type": "string", + "pattern": "^[\\/\\w]+$", + "default": "Logging", + "description": "Tab name.", + "maxLength": 250 + }, + "title": { + "type": "string", + "default": "Logging", + "description": "Tab title.", + "maxLength": 50 + }, + "label": { + "$ref": "../../common/common.json#/definitions/entityLabel" + }, + "field": { + "$ref": "../../common/common.json#/definitions/Field", + "default": "loglevel" + }, + "levels": { + "type": "array", + "default": [ + "DEBUG", + "INFO", + "WARNING", + "ERROR", + "CRITICAL" + ], + "description": "List of all possible log levels.", + "items": { + "type": "string" + } + }, + "defaultLevel": { + "type": "string", + "default": "INFO", + "description": "Default log level at the beginning." + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "PredefinedProxyTab": { + "type": "object", + "description": "Predefined Proxy tab configuration, can be used to reduce length of config", + "properties": { + "type": { + "type": "string", + "const": "proxyTab", + "description": "Exactly: proxyTab" + }, + "name": { + "type": "string", + "pattern": "^[\\/\\w]+$", + "default": "Proxy", + "description": "Tab name.", + "maxLength": 250 + }, + "title": { + "type": "string", + "default": "Proxy", + "description": "Tab title.", + "maxLength": 50 + }, + "enable_proxy": { + "type": "object", + "default": { + "type": "checkbox", + "label": "Enable", + "field": "proxy_enabled" + }, + "description": "Checkbox for enabling proxy" + }, + "proxy_type": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "default": { + "type": "singleSelect", + "label": "Proxy Type", + "required": false, + "options": { + "disableSearch": true, + "autoCompleteFields": [ + { + "value": "http", + "label": "http" + }, + { + "value": "socks4", + "label": "socks4" + }, + { + "value": "socks5", + "label": "socks5" + } + ] + }, + "defaultValue": "http", + "field": "proxy_type" + } + } + ], + "description": "Proxy type. Available values: http, socks4, socks5" + }, + "host": { + "type": "object", + "default": { + "type": "text", + "label": "Host", + "validators": [ + { + "type": "string", + "errorMsg": "Max host length is 4096", + "minLength": 0, + "maxLength": 4096 + }, + { + "type": "regex", + "errorMsg": "Proxy Host should not have special characters", + "pattern": "^[a-zA-Z]\\w*$" + } + ], + "field": "proxy_url" + }, + "description": "Host of the proxy" + }, + "port": { + "type": "object", + "default": { + "type": "text", + "label": "Port", + "validators": [ + { + "type": "number", + "range": [ + 1, + 65535 + ], + "isInteger": true + } + ], + "field": "proxy_port" + }, + "description": "Port of the proxy" + }, + "username": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "default": { + "type": "text", + "label": "Username", + "validators": [ + { + "type": "string", + "errorMsg": "Max length of username is 50", + "minLength": 0, + "maxLength": 50 + } + ], + "field": "proxy_username" + } + } + ], + "description": "Username used to access the proxy server." + }, + "password": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "default": { + "type": "text", + "label": "Password", + "validators": [ + { + "type": "string", + "errorMsg": "Max length of password is 8192", + "minLength": 0, + "maxLength": 8192 + } + ], + "encrypted": true, + "field": "proxy_password" + } + } + ], + "description": "Password assigned for the username" + }, + "dns_resolution": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "default": { + "type": "checkbox", + "label": "DNS resolution", + "field": "proxy_rdns" + } + } + ], + "description": "Specifies whether DNS resolution should be used or not." + }, + "options": { + "$ref": "../../common/common.json#/definitions/SaveValidatorHook" + }, + "hook": { + "$ref": "../../common/common.json#/definitions/Hook" + }, + "warning": { + "$ref": "../../common/common.json#/definitions/WarningMessage" + }, + "help": { + "$ref": "../../common/common.json#/definitions/help" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "ConfigurationTable": { + "type": "object", + "properties": { + "moreInfo": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string", + "pattern": "^\\w+$", + "description": "Used to display the data in a column." + }, + "label": { + "type": "string", + "maxLength": 30, + "description": "Title of the column." + }, + "mapping": { + "type": "object", + "description": "Used to map field values to more meaningful values." + } + }, + "required": [ + "field", + "label" + ] + }, + "description": "Specifies the list of fields that will be displayed in row form when the user clicks the Row Expand button." + }, + "header": { + "type": "array", + "description": "Specifies the list of columns in the table", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string", + "pattern": "^\\w+$", + "description": "Name of the field where the column data will be displayed." + }, + "label": { + "type": "string", + "maxLength": 30, + "description": "The title of the column" + }, + "mapping": { + "type": "object", + "description": "Used to map field values to more meaningful values." + }, + "customCell": { + "$ref": "../../common/common.json#/definitions/CustomCell" + } + }, + "required": [ + "field", + "label" + ] + } + }, + "customRow": { + "$ref": "../../common/common.json#/definitions/CustomRow" + }, + "actions": { + "type": "array", + "description": "Specifies what type of action can be performed on the stanza. The supported types are edit, clone, and delete.", + "items": { + "type": "string", + "enum": [ + "edit", + "delete", + "clone" + ] + } + } + }, + "required": [ + "header", + "actions" + ], + "description": "Configuration of single tab", + "additionalProperties": false + }, + "TabContent": { + "type": "object", + "description": "Content for separated Tab", + "properties": { + "entity": { + "$ref": "../../common/entity.json" + }, + "name": { + "type": "string", + "description": "Tab identificator", + "pattern": "^[\\/\\w]+$", + "maxLength": 250 + }, + "title": { + "type": "string", + "description": "Displayed title", + "maxLength": 50 + }, + "options": { + "$ref": "../../common/common.json#/definitions/SaveValidatorHook" + }, + "table": { + "$ref": "#/definitions/ConfigurationTable" + }, + "style": { + "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", + "type": "string", + "enum": [ + "page", + "dialog" + ] + }, + "conf": { + "type": "string", + "maxLength": 100, + "description": "Configuration name for a rest handler." + }, + "restHandlerName": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Handler name that extends the default behaviour of the UCC-generated REST handlers. (Do NOT use with restHandlerModule) " + }, + "restHandlerModule": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Module name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerClass) " + }, + "restHandlerClass": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Class name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerModule)" + }, + "hook": { + "$ref": "../../common/common.json#/definitions/Hook" + }, + "customTab": { + "description": "This property allows you to enable the custom tab feature.", + "$ref": "../../common/common.json#/definitions/CustomComponent" + }, + "warning": { + "$ref": "../../common/common.json#/definitions/WarningMessage" + }, + "hideForPlatform": { + "$ref": "../../common/common.json#/definitions/HideForPlatform" + }, + "groups": { + "$ref": "../../common/common.json#/definitions/Groups" + }, + "formTitle": { + "type": "string", + "maxLength": 100, + "description": "Custom modal title that replaces the default 'Add selectedTab' text. When specified, the modal will display 'Add' followed by the formTitle value" + } + }, + "anyOf": [ + { + "required": [ + "entity", + "name", + "title" + ] + }, + { + "required": [ + "customTab", + "name", + "title" + ] + } + ], + "additionalProperties": false + } + }, + "properties": { + "title": { + "type": "string", + "description": "Title of Configuration page", + "maxLength": 60 + }, + "description": { + "type": "string", + "description": "Description under title of Configuration page", + "maxLength": 200 + }, + "subDescription": { + "$ref": "../../common/common.json#/definitions/SubDescription" + }, + "tabs": { + "description": "Array of forms to be displayed in separate tabs", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TabContent" + }, + { + "$ref": "#/definitions/PredefinedLoggingTab" + }, + { + "$ref": "#/definitions/PredefinedProxyTab" + } + ] + }, + "minItems": 1 + }, + "capabilities": { + "$ref": "../../common/common.json#/definitions/capabilities" + } + }, + "required": [ + "title", + "tabs" + ], + "description": "Page for account configuration, proxy configuration, and logging level configuration.", + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Pages/dashboard.json b/splunk_add_on_ucc_framework/schema/subschema/Pages/dashboard.json new file mode 100644 index 0000000000..8953b5dcaa --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Pages/dashboard.json @@ -0,0 +1,98 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Pages/dashboard.json", + "title": "DashboardPage", + "type": "object", + "definitions": { + "DashboardPanel": { + "type": "object", + "description": "Dashboard panel that provides operational insights and monitoring information for the add-on.", + "properties": { + "name": { + "type": "string", + "maxLength": 100, + "description": "Identifier for the dashboard panel" + } + }, + "required": [ + "name" + ], + "additionalProperties": false + } + }, + "properties": { + "panels": { + "type": "array", + "description": "List of panels to be generated. Supported for now: 'Overview', 'Data ingestion', 'Errors in the add-on'.", + "minItems": 1, + "items": { + "$ref": "#/definitions/DashboardPanel" + } + }, + "troubleshooting_url": { + "type": "string", + "description": "Link to external TA documentation used for redirection on error dashboard page", + "format": "uri" + }, + "settings": { + "type": "object", + "description": "Additional settings for monitoring dashboard.", + "properties": { + "custom_tab_name": { + "type": "string" + }, + "custom_license_usage": { + "type": "object", + "description": "Settings for creating custom search query for license usage.", + "properties": { + "determine_by": { + "type": "string", + "description": "Specify what to use (source or sourcetype) to search events in license usage.", + "enum": [ + "source", + "sourcetype", + "host", + "index" + ] + }, + "search_condition": { + "type": "array", + "description": "Elements that will be used as a query condition.", + "minItems": 1, + "items": { + "type": "string" + } + } + }, + "required": [ + "determine_by", + "search_condition" + ], + "additionalProperties": false + }, + "error_panel_log_lvl": { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "type": "string", + "enum": [ + "ERROR", + "CRITICAL" + ] + } + ] + }, + "uniqueItems": true + } + }, + "additionalProperties": false + } + }, + "required": [ + "panels" + ], + "description": "The dashboard page provides some additional information about the add-on operations to increase the visibility into what the add-on is actually doing under the hood.", + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Pages/inputs.json b/splunk_add_on_ucc_framework/schema/subschema/Pages/inputs.json new file mode 100644 index 0000000000..a1703783fb --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Pages/inputs.json @@ -0,0 +1,401 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Pages/inputs.json", + "title": "InputsPage", + "type": "object", + "description": "The input page stores configuration information for data collection. Multiple inputs can be created on the Inputs page.", + "definitions": { + "inputsUniqueAcrossSingleService": { + "description": "Defines if inputs in different services can share same name.", + "type": "boolean", + "default": false + }, + "useInputToggleConfirmation": { + "type": "boolean", + "description": "When true displays additional confirmation modal when toggling single input status.", + "default": false + }, + "InputsTable": { + "type": "object", + "properties": { + "moreInfo": { + "type": "array", + "description": "Specifies the list of fields that will be displayed in row form when the user clicks the Row Expand button.", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string", + "pattern": "^\\w+$", + "description": "Used to dispaly the data in a column." + }, + "label": { + "type": "string", + "maxLength": 30, + "description": "Title of the column." + }, + "mapping": { + "type": "object", + "description": "Used to map field values to more meaningful values." + } + }, + "required": [ + "field", + "label" + ] + } + }, + "header": { + "type": "array", + "description": "Specifies the list of columns in the table.", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string", + "pattern": "^\\w+$", + "description": "Name of the field where the column data will be displayed." + }, + "label": { + "type": "string", + "maxLength": 30, + "description": "Text displayed next to entity field" + }, + "mapping": { + "type": "object", + "description": "Used to map field values to more meaningful values." + }, + "customCell": { + "$ref": "../../common/common.json#/definitions/CustomCell" + } + }, + "required": [ + "field", + "label" + ] + } + }, + "customRow": { + "$ref": "../../common/common.json#/definitions/CustomRow" + }, + "actions": { + "type": "array", + "description": "Specifies what type of action can be performed on the stanza. The supported types are edit, clone, and delete.", + "items": { + "type": "string", + "enum": [ + "edit", + "delete", + "clone", + "search" + ] + } + } + }, + "required": [ + "header", + "actions" + ], + "description": "Displays input stanzas in a tabular format.", + "additionalProperties": false + }, + "InputPageSingleTable": { + "type": "object", + "properties": { + "title": { + "type": "string", + "maxLength": 60, + "description": "Title of Input Page" + }, + "description": { + "description": "It provides a brief summary of an inputs page.", + "type": "string", + "maxLength": 200 + }, + "subDescription": { + "$ref": "../../common/common.json#/definitions/SubDescription" + }, + "table": { + "$ref": "#/definitions/InputsTable" + }, + "groupsMenu": { + "type": "array", + "description": "This property allows you to enable the multi-level menu feature.", + "items": { + "type": "object", + "properties": { + "groupName": { + "type": "string", + "pattern": "^[0-9a-zA-Z][\\w-]*$", + "maxLength": 50, + "description": "id of group that will be used for group association." + }, + "groupTitle": { + "type": "string", + "maxLength": 100, + "description": "Name of group that will be displayed inside menu." + }, + "groupServices": { + "type": "array", + "description": "List of services that is inside group.", + "items": { + "type": "string", + "description": "Name of the service.", + "pattern": "^[0-9a-zA-Z][\\w-]*$", + "maxLength": 50 + } + } + }, + "required": [ + "groupTitle", + "groupName" + ] + } + }, + "services": { + "type": "array", + "description": "It specifies a list of modular inputs.", + "items": { + "type": "object", + "properties": { + "name": { + "description": "It defines the particular service name.", + "type": "string", + "pattern": "^[0-9a-zA-Z][\\w-]*$", + "maxLength": 50 + }, + "title": { + "description": "It shows the title of the service.", + "type": "string", + "maxLength": 100 + }, + "subTitle": { + "description": "It shows the subtitle (or additional information) of the service.", + "type": "string", + "maxLength": 50 + }, + "entity": { + "$ref": "../../common/entity.json" + }, + "options": { + "$ref": "../../common/common.json#/definitions/SaveValidatorHook" + }, + "groups": { + "$ref": "../../common/common.json#/definitions/Groups" + }, + "style": { + "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", + "type": "string", + "enum": [ + "page", + "dialog" + ] + }, + "hook": { + "$ref": "../../common/common.json#/definitions/Hook" + }, + "conf": { + "type": "string", + "maxLength": 100, + "description": "Configuration name for a rest handler." + }, + "restHandlerName": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Handler name that extends the default behaviour of the UCC-generated REST handlers. (Do NOT use with restHandlerModule) " + }, + "restHandlerModule": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Module name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerClass) " + }, + "restHandlerClass": { + "type": "string", + "maxLength": 100, + "description": "Specify rest Class name that extends the default behaviour of the UCC-generated REST handlers. (Use with restHandlerModule)" + }, + "inputHelperModule": { + "type": "string", + "maxLength": 100, + "description": "A module that contains `validate_input` and `stream_events` methods. By default it is not used." + }, + "warning": { + "$ref": "../../common/common.json#/definitions/WarningMessage" + }, + "disableNewInput": { + "type": "boolean", + "description": "Defines whether a newly created input of a service should be disabled by default.", + "default": false + }, + "hideForPlatform": { + "$ref": "../../common/common.json#/definitions/HideForPlatform" + }, + "formTitle": { + "type": "string", + "maxLength": 100, + "description": "Custom modal title that replaces the default 'Add inputname' text in the header. When specified, the header will display 'Add' followed by the formTitle value" + } + }, + "not": { + "required": [ + "table" + ] + }, + "required": [ + "name", + "title", + "entity" + ] + } + }, + "hideFieldId": { + "type": "string" + }, + "readonlyFieldId": { + "type": "string" + }, + "useInputToggleConfirmation": { + "$ref": "#/definitions/useInputToggleConfirmation" + }, + "inputsUniqueAcrossSingleService": { + "$ref": "#/definitions/inputsUniqueAcrossSingleService" + }, + "capabilities": { + "$ref": "../../common/common.json#/definitions/capabilities" + } + }, + "required": [ + "title", + "table", + "services" + ], + "description": "Input Page definition where there is only one single tabel listing all services.", + "additionalProperties": false + }, + "InputPageTablePerService": { + "type": "object", + "properties": { + "title": { + "type": "string", + "maxLength": 60, + "description": "Title of Input Page" + }, + "services": { + "description": "Specifies a list of modular inputs.", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "It defines the particular service name.", + "pattern": "^[0-9a-zA-Z][0-9a-zA-Z_-]*$", + "maxLength": 50 + }, + "title": { + "description": "It shows the title of the service.", + "type": "string", + "maxLength": 100 + }, + "subTitle": { + "type": "string", + "description": "It shows the subtitle (or additional information) of the service.", + "maxLength": 50 + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "table": { + "$ref": "#/definitions/InputsTable" + }, + "useInputToggleConfirmation": { + "$ref": "#/definitions/useInputToggleConfirmation" + }, + "entity": { + "$ref": "../../common/entity.json" + }, + "options": { + "$ref": "../../common/common.json#/definitions/SaveValidatorHook" + }, + "groups": { + "$ref": "../../common/common.json#/definitions/Groups" + }, + "style": { + "description": "By specifying this property in the global configuration file, the forms can either be opened as a new page or in a dialog.", + "type": "string", + "enum": [ + "page", + "dialog" + ] + }, + "hook": { + "$ref": "../../common/common.json#/definitions/Hook" + }, + "conf": { + "type": "string", + "maxLength": 100 + }, + "restHandlerName": { + "type": "string", + "maxLength": 100 + }, + "restHandlerModule": { + "type": "string", + "maxLength": 100 + }, + "restHandlerClass": { + "type": "string", + "maxLength": 100 + }, + "inputHelperModule": { + "type": "string", + "maxLength": 100 + } + }, + "required": [ + "name", + "title", + "table", + "entity" + ] + }, + "hideForPlatform": { + "$ref": "../../common/common.json#/definitions/HideForPlatform" + }, + "formTitle": { + "type": "string", + "maxLength": 100, + "description": "Custom modal title that replaces the default 'Add selectedInputTab' text in the header. When specified, the header will display 'Add' followed by the formTitle value" + } + }, + "hideFieldId": { + "type": "string" + }, + "readonlyFieldId": { + "type": "string" + }, + "inputsUniqueAcrossSingleService": { + "$ref": "#/definitions/inputsUniqueAcrossSingleService" + }, + "capabilities": { + "$ref": "../../common/common.json#/definitions/capabilities" + } + }, + "required": [ + "title", + "services" + ], + "description": "Input Page definition where there are tabs for each service with separate table listing input service entries.", + "additionalProperties": false + } + }, + "oneOf": [ + { + "$ref": "#/definitions/InputPageSingleTable" + }, + { + "$ref": "#/definitions/InputPageTablePerService" + } + ] +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/Pages/pages.json b/splunk_add_on_ucc_framework/schema/subschema/Pages/pages.json new file mode 100644 index 0000000000..d3e3ab6187 --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/Pages/pages.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/Pages/pages.json", + "title": "Pages", + "type": "object", + "description": "Definition of addon pages (configuration, inputs, dashboard)", + "properties": { + "configuration": { + "$ref": "./configuration.json" + }, + "inputs": { + "$ref": "./inputs.json" + }, + "dashboard": { + "$ref": "./dashboard.json" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/customSearchCommand.json b/splunk_add_on_ucc_framework/schema/subschema/customSearchCommand.json new file mode 100644 index 0000000000..1bc8e178ee --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/customSearchCommand.json @@ -0,0 +1,211 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/customSearchCommand.json", + "title": "customSearchCommand", + "type": "object", + "description": "Support for custom Search Command.", + "definitions": { + "arguments": { + "type": "object", + "description": "Arguments used for custom search command", + "properties": { + "name": { + "type": "string", + "description": "Name of the argument" + }, + "required": { + "type": "boolean", + "default": true, + "description": "Specifies if the argument is required or not" + }, + "validate": { + "$ref": "#/definitions/CustomSearchCommandValidator" + }, + "defaultValue": { + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "description": "Provide default value to the arguments passed for custom search command" + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + "CustomSearchCommandValidator": { + "type": "object", + "description": "It is used to validate the values of arguments for custom search command", + "oneOf": [ + { + "$ref": "#/definitions/CustomIntegerValidator" + }, + { + "$ref": "#/definitions/CustomFloatValidator" + }, + { + "$ref": "#/definitions/CustomRegularExpressionValidator" + }, + { + "$ref": "#/definitions/CustomFieldnameValidator" + }, + { + "$ref": "#/definitions/CustomBooleanValidator" + } + ] + }, + "CustomIntegerValidator": { + "type": "object", + "properties": { + "minimum": { + "type": "number", + "description": "Minimum value used for validation" + }, + "maximum": { + "type": "number", + "description": "Maximum value used for validation" + }, + "type": { + "const": "Integer", + "type": "string", + "description": "This is integer Validator for custom search command, provide at least one of `minimumValue` or `maximumValue`" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "CustomFloatValidator": { + "type": "object", + "properties": { + "minimumValue": { + "type": "number", + "description": "Minimum value used for validation" + }, + "maximumValue": { + "type": "number", + "description": "Maximum value used for validation" + }, + "type": { + "const": "Float", + "type": "string", + "description": "This is Float Validator for custom search command, provide at least one of `minimumValue` or `maximumValue` for validation purpose." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "CustomRegularExpressionValidator": { + "type": "object", + "properties": { + "type": { + "const": "RegularExpression", + "type": "string", + "description": "This is RegularExpression Validator which validates if the input value is a valid regular expression pattern or not." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "CustomFieldnameValidator": { + "type": "object", + "properties": { + "type": { + "const": "Fieldname", + "type": "string", + "description": "Validates field name option values." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "CustomBooleanValidator": { + "type": "object", + "properties": { + "type": { + "const": "Boolean", + "type": "string", + "description": "Validates Boolean option values." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + } + }, + "properties": { + "commandName": { + "type": "string", + "pattern": "^[a-z0-9]+$", + "maxLength": 100, + "description": "Name of the custom Search Command." + }, + "fileName": { + "type": "string", + "pattern": "^\\w+\\.py$", + "description": "Name of the file which contains logic for custom search command. The file should be a python file only." + }, + "commandType": { + "type": "string", + "description": "Type of the custom search command. There are 4 types of command i.e generating, streaming, transforming and dataset processing", + "enum": [ + "generating", + "streaming", + "dataset processing", + "transforming" + ] + }, + "requiredSearchAssistant": { + "type": "boolean", + "default": false, + "description": "Specifies if search assistant is required or not. If yes then searchbnf.conf will be generated." + }, + "description": { + "type": "string", + "description": "Description of the custom search command. It is an required attribute for searchbnf.conf." + }, + "syntax": { + "type": "string", + "maxLength": 100, + "description": "Syntax for the custom search command. It is an required attribute for searchbnf.conf." + }, + "usage": { + "type": "string", + "description": "Specifies what will be the usage of custom search command. It is an required attribute for searchbnf.conf.", + "enum": [ + "public", + "private", + "deprecated" + ] + }, + "arguments": { + "type": "array", + "items": { + "$ref": "#/definitions/arguments" + }, + "minItems": 1 + } + }, + "required": [ + "commandName", + "fileName", + "commandType", + "arguments" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/meta.json b/splunk_add_on_ucc_framework/schema/subschema/meta.json new file mode 100644 index 0000000000..08c3bed8bc --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/meta.json @@ -0,0 +1,168 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/meta.json", + "title": "Meta", + "type": "object", + "properties": { + "displayName": { + "type": "string", + "maxLength": 200, + "description": "Name displayed for end user." + }, + "name": { + "type": "string", + "pattern": "^(?!^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$)(?!.*\\.(tar(\\.gz)?|tgz|spl)$)[A-Za-z_.-][A-Za-z0-9_.-]*[A-Za-z0-9_-]$", + "description": "Name used for API endpoints and all code references separating separating endpoints from any other app." + }, + "restRoot": { + "type": "string", + "pattern": "^[\\w-]+$", + "description": "String used to create API endpoints." + }, + "apiVersion": { + "type": "string", + "pattern": "^(?:\\d{1,3}\\.){2}\\d{1,3}$" + }, + "version": { + "type": "string", + "description": "Build version" + }, + "schemaVersion": { + "type": "string", + "pattern": "^(?:\\d{1,3}\\.){2}\\d{1,3}$", + "description": "Version of json schema used in build process." + }, + "_uccVersion": { + "type": "string", + "description": "Version of UCC used during build process. Do not use." + }, + "hideUCCVersion": { + "type": "boolean", + "description": "Hide the label 'Made with UCC' on the Configuration page" + }, + "checkForUpdates": { + "type": "boolean", + "default": true, + "description": "Ability to configure app.conf->package.check_for_updates from globalConfig file." + }, + "defaultView": { + "type": "string", + "description": "Define which view should be loaded on TA load.", + "anyOf": [ + { + "const": "inputs" + }, + { + "const": "configuration" + }, + { + "const": "dashboard" + }, + { + "const": "search" + } + ] + }, + "os-dependentLibraries": { + "type": "array", + "description": "This feature allows you to download and unpack libraries with appropriate binaries for the indicated operating system during the build process.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the library we want to download." + }, + "version": { + "type": "string", + "description": "Specific version of the given library." + }, + "dependencies": { + "type": "boolean", + "description": "(Optional) Parameter which determines whether the --no-deps flag will be used when installing the package from pip." + }, + "platform": { + "type": "string", + "description": "Platform for downloading the specified library." + }, + "python_version": { + "type": "string", + "description": "Python version compatible with the library." + }, + "target": { + "type": "string", + "description": " Path where the selected library will be unpacked." + }, + "os": { + "description": "Name of the operating system which the library is intended for. linux/windows/darwin", + "anyOf": [ + { + "const": "linux", + "type": "string", + "description": "Exactly: linux" + }, + { + "const": "windows", + "type": "string", + "description": "Exactly: windows" + }, + { + "const": "darwin", + "type": "string", + "description": "Exactly: darwin" + } + ] + }, + "ignore_requires_python": { + "type": "boolean", + "description": "(Optional) Parameter which determines whether the --ignore-requires-python flag will be used when installing the package from pip." + } + }, + "required": [ + "name", + "version", + "platform", + "python_version", + "target", + "os" + ] + } + }, + "supportedThemes": { + "description": "This feature allows you to choose theme based on the given option i.e. light and dark", + "type": "array", + "items": { + "type": "string", + "enum": [ + "light", + "dark" + ] + } + }, + "isVisible": { + "type": "boolean", + "default": true, + "description": "Ability to configure app.conf->ui.is_visible from globalConfig file." + }, + "showFooter": { + "type": "boolean", + "default": true, + "description": "Ability to show the footer component on every page of add-on" + }, + "supportedPythonVersion": { + "description": "This feature allows you to specify which python version your app would use.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "displayName", + "name", + "restRoot", + "version" + ], + "description": "Metadata regarding build", + "additionalProperties": false +} \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/schema/subschema/options.json b/splunk_add_on_ucc_framework/schema/subschema/options.json new file mode 100644 index 0000000000..da63a95a5a --- /dev/null +++ b/splunk_add_on_ucc_framework/schema/subschema/options.json @@ -0,0 +1,254 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "subschema/options.json", + "title": "Options", + "type": "object", + "description": "Additional options for the addon", + "definitions": { + "OpenApiType": { + "type": "object", + "description": "OpenAPI request or response param type.", + "oneOf": [ + { + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean" + ] + }, + "nullable": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "properties": { + "type": { + "type": "string", + "const": "array" + }, + "items": { + "$ref": "#/definitions/OpenApiType" + }, + "nullable": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "properties": { + "type": { + "type": "string", + "const": "object" + }, + "properties": { + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9_]+$": { + "$ref": "#/definitions/OpenApiType" + } + } + }, + "required": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "properties" + ] + }, + { + "properties": { + "anyOf": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenApiType" + } + }, + "nullable": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "anyOf" + ] + }, + { + "properties": { + "oneOf": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenApiType" + } + }, + "nullable": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "oneOf" + ] + } + ] + }, + "RestHandlerActionParams": { + "type": "object", + "description": "Request or response parameters for a particular action.", + "additionalProperties": false, + "patternProperties": { + "^[a-zA-Z0-9_]+$": { + "type": "object", + "properties": { + "required": { + "type": "boolean", + "default": false + }, + "schema": { + "$ref": "#/definitions/OpenApiType" + } + }, + "additionalProperties": false, + "required": [ + "schema" + ] + } + } + }, + "RestHandlerParams": { + "type": "object", + "description": "Request or response parameters.", + "additionalProperties": false, + "properties": { + "list": { + "$ref": "#/definitions/RestHandlerActionParams" + }, + "edit": { + "$ref": "#/definitions/RestHandlerActionParams" + }, + "create": { + "$ref": "#/definitions/RestHandlerActionParams" + }, + "remove": { + "$ref": "#/definitions/RestHandlerActionParams" + } + } + }, + "RestHandler": { + "type": "object", + "description": "Rest handlers not automatically generated by UCC.", + "properties": { + "name": { + "type": "string", + "description": "The name of the handler.", + "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$" + }, + "resourcePresent": { + "type": "boolean", + "description": "Specifies whether the collection should expose its resources as well via web.conf or not.", + "default": false + }, + "parentResource": { + "type": "string", + "description": "Specifies parentResource for the endpoint. It would be generated for match attribute in restmap.conf", + "default": "/" + }, + "capabilities": { + "$ref": "../common/common.json#/definitions/capabilities" + }, + "endpoint": { + "type": "string", + "description": "The endpoint for the custom rest handler.", + "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$" + }, + "handlerType": { + "type": "string", + "description": "The type of the handler.", + "enum": [ + "EAI" + ] + }, + "registerHandler": { + "type": "object", + "description": "Parameters needed to register the endpoint in web.conf and restmap.conf", + "properties": { + "file": { + "type": "string", + "description": "The file where the custom rest handler is located.", + "pattern": "^[a-zA-Z0-9_]+\\.py$" + }, + "actions": { + "type": "array", + "description": "The actions that the custom rest handler supports.", + "items": { + "type": "string", + "description": "The action that the custom rest handler supports.", + "enum": [ + "list", + "edit", + "create", + "remove" + ], + "minItems": 1, + "uniqueItems": true + } + } + }, + "additionalProperties": false, + "required": [ + "file", + "actions" + ] + }, + "requestParameters": { + "type": "object", + "description": "The parameters that the custom rest handler supports.", + "$ref": "#/definitions/RestHandlerParams" + }, + "responseParameters": { + "type": "object", + "description": "The parameters that the custom rest handler returns.", + "$ref": "#/definitions/RestHandlerParams" + } + }, + "additionalProperties": false, + "required": [ + "name", + "endpoint", + "handlerType" + ] + } + }, + "properties": { + "restHandlers": { + "type": "array", + "items": { + "$ref": "#/definitions/RestHandler" + } + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/tests/unit/commands/test_init.py b/tests/unit/commands/test_init.py index b436eba390..bdb9de72e7 100644 --- a/tests/unit/commands/test_init.py +++ b/tests/unit/commands/test_init.py @@ -307,15 +307,11 @@ def test_init_when_empty_string_passed_for_author(mock_generate_addon, caplog): def test_valid_regex(): - file_path = f"{helpers.get_path_to_source_dir()}/schema/schema.json" + file_path = f"{helpers.get_path_to_source_dir()}/schema/subschema/meta.json" with open(file_path) as file: content = file.read() schema_json_content = json.loads(content) - restRoot_regex = schema_json_content["definitions"]["Meta"]["properties"][ - "restRoot" - ]["pattern"] - name_regex = schema_json_content["definitions"]["Meta"]["properties"]["name"][ - "pattern" - ] + restRoot_regex = schema_json_content["properties"]["restRoot"]["pattern"] + name_regex = schema_json_content["properties"]["name"]["pattern"] assert init.ADDON_REST_ROOT_RE_STR == restRoot_regex assert init.ADDON_NAME_RE_STR == name_regex diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index fc5b1e81ff..c2b6a1a984 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -176,11 +176,5 @@ def wrapper(func, module, name): @pytest.fixture -def schema_path(): - return Path(module_init_path).parent / "schema" / "schema.json" - - -@pytest.fixture -def schema_json(schema_path): - with schema_path.open() as fp: - return json.load(fp) +def base_schema_dir_path(): + return Path(module_init_path).parent / "schema" diff --git a/tests/unit/test_global_config_validator.py b/tests/unit/test_global_config_validator.py index e1d8d77118..a8c429d7d0 100644 --- a/tests/unit/test_global_config_validator.py +++ b/tests/unit/test_global_config_validator.py @@ -5,6 +5,8 @@ from typing import Any import pytest +import os +import json import tests.unit.helpers as helpers from splunk_add_on_ucc_framework import dashboard @@ -552,13 +554,17 @@ def open(*args, **kwargs): validator._validate_config_against_schema() -def test_check_list_of_entities_to_skip_empty_validators_check(schema_json): +def test_check_list_of_entities_to_skip_empty_validators_check(base_schema_dir_path): # This test checks if the ENTITY_TYPES_WITHOUT_VALIDATORS set is up to date with the schema def_pattern = re.compile(r"#/definitions/(\w+)") + file_path = os.path.join(base_schema_dir_path, "common", "entity.json") + with open(file_path) as file: + content = file.read() + schema_json = json.loads(content) any_of_entity_types = set() - for any_of in schema_json["definitions"]["AnyOfEntity"]["items"]["anyOf"]: + for any_of in schema_json["items"]["anyOf"]: match = def_pattern.search(any_of["$ref"]) assert match, any_of @@ -579,7 +585,7 @@ def test_check_list_of_entities_to_skip_empty_validators_check(schema_json): ) -def test_should_warn_on_empty_validators(schema_json): +def test_should_warn_on_empty_validators(): # Radio cannot have validators at all, so no warning should be raised assert not should_warn_on_empty_validators( { diff --git a/tests/unit/test_schema.py b/tests/unit/test_schema.py index 4f8fb87979..5ff340708e 100644 --- a/tests/unit/test_schema.py +++ b/tests/unit/test_schema.py @@ -1,14 +1,61 @@ -import functools -from typing import Any - -import jsonschema +import json import pytest +from pathlib import Path +from jsonschema import Draft7Validator +from referencing import Registry, Resource from jsonschema.exceptions import ValidationError +from typing import Any + + +# Build registry once for all tests +@pytest.fixture(scope="session") +def schema_registry(): + """Load all schema files into a registry (matches production logic).""" + schema_dir = Path("splunk_add_on_ucc_framework/schema") + registry = Registry() + + for json_path in schema_dir.rglob("*.json"): + schema_data = json.loads(json_path.read_text()) + resource = Resource.from_contents(schema_data) + + # Path relative to schema root, EXACTLY like runtime + schema_id = str(json_path.relative_to(schema_dir)) + + registry = registry.with_resource(uri=schema_id, resource=resource) + + return registry + + +# Load root schema.json +@pytest.fixture(scope="session") +def root_schema(): + schema_dir = Path("splunk_add_on_ucc_framework/schema") + return json.loads((schema_dir / "schema.json").read_text()) +# Create validator fixture @pytest.fixture -def schema_validate(schema_json): - return functools.partial(jsonschema.validate, schema=schema_json) +def schema_validate(root_schema, schema_registry): + """ + Returns a function that validates config against the root schema + using the registry (matches the updated validator). + """ + validator = Draft7Validator(root_schema, registry=schema_registry) + + def validate_func(instance): + errors = sorted(validator.iter_errors(instance), key=lambda e: e.path) + if errors: + for error in errors: + print( + "\nVALIDATION ERROR:", + { + "path": list(error.path), + "message": error.message, + }, + ) + raise ValidationError("schema validation failed") + + return validate_func @pytest.fixture @@ -26,7 +73,8 @@ def with_tab_entity(self, entity, tabnum=0): def test_logging_component_short(schema_validate, config): - schema_validate(config.with_tab({"type": "loggingTab"})) + payload = config.with_tab({"type": "loggingTab"}) + schema_validate(payload) def test_logging_component_long(schema_validate, config): diff --git a/ui/src/CustomEntity/User.stories.tsx b/ui/src/CustomEntity/User.stories.tsx index 693302622a..16b433b862 100644 --- a/ui/src/CustomEntity/User.stories.tsx +++ b/ui/src/CustomEntity/User.stories.tsx @@ -4,7 +4,6 @@ import type { Meta, StoryObj } from '@storybook/react'; import { z } from 'zod'; import BaseFormView from '../components/BaseFormView/BaseFormView'; import { setUnifiedConfig } from '../util/util'; -import schema from '../../../splunk_add_on_ucc_framework/schema/schema.json'; import { generateGlobalConfig } from './generateGlobalConfig'; import { AnyOfEntitySchema, @@ -106,10 +105,9 @@ const meta: Meta = { description: 'Any Entity array', properties: { entity: { - $ref: '#/definitions/AnyOfEntity', + $ref: './common/entity.json', }, }, - definitions: schema.definitions, }, }, },