From 6ddb0290f994122eaa29e154da438c3bf6b3c9ff Mon Sep 17 00:00:00 2001 From: Andreas Heinrich Date: Thu, 24 Aug 2023 13:20:28 +0200 Subject: [PATCH] Add yaml error definition --- schemas/CMakeLists.txt | 1 + schemas/error.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 schemas/error.yaml diff --git a/schemas/CMakeLists.txt b/schemas/CMakeLists.txt index b6f9e2bf..2b28e6b9 100644 --- a/schemas/CMakeLists.txt +++ b/schemas/CMakeLists.txt @@ -4,5 +4,6 @@ install( config.yaml manifest.yaml type.yaml + error.yaml DESTINATION "${CMAKE_INSTALL_DATADIR}/everest/schemas" ) diff --git a/schemas/error.yaml b/schemas/error.yaml new file mode 100644 index 00000000..0e7556f4 --- /dev/null +++ b/schemas/error.yaml @@ -0,0 +1,40 @@ +$schema: http://json-schema.org/draft-07/schema# +description: Json schema for EVerest error definition files +$defs: + error_list_subschema: + allOf: + - $ref: http://json-schema.org/draft-07/schema# + - type: object + # require at least a type declaration + required: + - name + - description + properties: + name: + type: string + minLength: 2 + description: + type: string + minLength: 2 + # allow all sorts of entries (should be a json schema!) + additionalProperties: true +type: object +required: + - description +properties: + description: + type: string + minLength: 2 + errors: + description: This describes a list of errors of this unit + type: array + patternProperties: + # arbitrary type name + ^[a-zA-Z_][a-zA-Z0-9_.-]*$: + description: json schema declaring the error + $ref: '#/$defs/error_list_subschema' + # don't allow arbitrary additional properties + additionalProperties: false + # add empty types if not already present + default: {} +additionalProperties: false