$schema: http://json-schema.org/draft-07/schema# description: Json schema for EVerest interface files $defs: # all subschemas can not use allOf with the draft-07 schema because that will cause our validator to # add all draft-07 default values which never validate (the {"not": true} default contradicts everything) # --> validating against draft-07 will be done in an extra step in config.cpp var_subschema: type: object # require at least a type declaration for this command/result schema required: - type - description properties: type: type: - string - array items: type: string uniqueItems: true description: type: string minLength: 2 qos: "type": "integer" "minimum": 0 "maximum": 2 "default": 2 # we don't allow default values default: false # allow all sorts of entries (should be a json schema!) additionalProperties: true cmd_arguments_subschema: type: object patternProperties: # arbitrary argument name ^[a-zA-Z_][a-zA-Z0-9_.-]*$: type: object # require at least a type declaration for this command/result schema required: - type - description properties: type: type: - array - string items: type: string uniqueItems: true pattern: ^(?!null).*$ description: type: string minLength: 2 # we don't allow default values default: false # allow all sorts of entries (should be a json schema!) additionalProperties: true # only allow argument names conforming to our pattern above additionalProperties: false default: {} cmd_result_subschema: type: object # require at least a type declaration for this command/result schema required: - type - description properties: type: type: - array - string items: type: string uniqueItems: true pattern: ^(?!null).*$ description: type: string minLength: 2 # we don't allow default values default: false # allow all sorts of entries (should be a json schema!) additionalProperties: true default: type: 'null' description: This returns nothing type: object required: - description properties: description: type: string minLength: 2 cmds: description: >- This describes a list of commands for this unit having arguments and result declared as json schema type: object patternProperties: # arbitrary command name ^[a-zA-Z_][a-zA-Z0-9_.-]*$: type: object description: >- the keys 'arguments' and 'result' declare json schemas defining the arguments and result for this command (default: 'type': 'null') required: - description properties: description: type: string minLength: 2 # default is an empty arguments/result list arguments: $ref: '#/$defs/cmd_arguments_subschema' result: $ref: '#/$defs/cmd_result_subschema' default: {} # don't allow arbitrary additional properties additionalProperties: false # don't allow arbitrary additional properties additionalProperties: false # add empty cmds if not already present default: {} vars: description: This describes a list of exported variables of this unit type: object patternProperties: # arbitrary variable name ^[a-zA-Z_][a-zA-Z0-9_.-]*$: description: >- json schema declaring the contents of the variables exported by this unit $ref: '#/$defs/var_subschema' # don't allow arbitrary additional properties additionalProperties: false # add empty vars if not already present default: {} errors: description: This describes a list of error list allowed to be raised by this unit type: array items: type: object required: - reference properties: reference: anyOf: # reference to a complete error list # (e.g. /errors/example) - type: string pattern: ^/errors/[a-z][a-zA-Z0-9_]*$ # reference to a single error # (e.g. /errors/example#/ExampleErrorA) - type: string pattern: ^/errors/[a-z][a-zA-Z0-9_]*#/[A-Z][A-Za-z0-9]*$ additionalProperties: false default: [] additionalProperties: false