diff options
author | vasraz <vasyl.razinkov@est.tech> | 2023-06-28 15:34:47 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2023-06-29 10:31:23 +0000 |
commit | 2e4af1e0c0611851f450b2e215485064f6795958 (patch) | |
tree | 2c766e17841c24dc40faa98ff260234ea2cfa80a /catalog-be/src/test/resources/yamlValidation | |
parent | 6d4057b032a30daa8388f9f1a323eae1581eb91c (diff) |
Implement YAML Validator
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I0365d4160984e4d68906959fb801ec7da5449b77
Issue-ID: SDC-4537
Diffstat (limited to 'catalog-be/src/test/resources/yamlValidation')
17 files changed, 456 insertions, 0 deletions
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml new file mode 100644 index 0000000000..ca05128ddd --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml @@ -0,0 +1 @@ +tosca_definitions_version:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml new file mode 100644 index 0000000000..ca05128ddd --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml @@ -0,0 +1 @@ +tosca_definitions_version:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml new file mode 100644 index 0000000000..85683a0e63 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml @@ -0,0 +1,2 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml new file mode 100644 index 0000000000..ae209d17da --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml @@ -0,0 +1,3 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml new file mode 100644 index 0000000000..00d452c440 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml @@ -0,0 +1,4 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml new file mode 100644 index 0000000000..74e2c8a114 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml @@ -0,0 +1,4 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml new file mode 100644 index 0000000000..6eb68d05d8 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml @@ -0,0 +1,5 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml new file mode 100644 index 0000000000..21b54453b2 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml @@ -0,0 +1,6 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml new file mode 100644 index 0000000000..00073a3cac --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml @@ -0,0 +1,7 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml new file mode 100644 index 0000000000..2ccb8dd3fa --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml @@ -0,0 +1,7 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml new file mode 100644 index 0000000000..d7e219726f --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml @@ -0,0 +1,9 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
+ entry_schema:
+ type:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml new file mode 100644 index 0000000000..8e9ade8473 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml @@ -0,0 +1,14 @@ +tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
+ entry_schema:
+ type: boolean
+ descriptor_id:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml new file mode 100644 index 0000000000..bfc5f2a48f --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml @@ -0,0 +1,20 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 +data_types: + datatype_test: + derived_from: tosca.datatypes.Root + properties: + pr_1: + type: list + entry_schema: + type: boolean + default: [ + pr_2: + type: map + entry_schema: + type: boolean + default: } + descriptor_id: + type: string + description: Globally unique identifier of the VNFD + default: 'Missing quote + required: true diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml new file mode 100644 index 0000000000..991477ccbd --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml @@ -0,0 +1,85 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 +data_types: + datatype_test: + derived_from: tosca.datatypes.Root + properties: + pr_1: + type: map + entry_schema: + type: boolean + pr_2: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - equal: fgh + pr_3: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_than: a + pr_4: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_or_equal: b + pr_5: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_than: z + pr_6: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_or_equal: y + pr_7: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - in_range: + - bb + - yy + pr_8: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - valid_values: + - dd + - rr + pr_9: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - length: 3 + pr_10: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_11: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_12: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - max_length: 3 + pr_13: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - pattern: '[a-z]' diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml new file mode 100644 index 0000000000..d4ba271134 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml @@ -0,0 +1,84 @@ +data_types: + datatype_test: + derived_from: tosca.datatypes.Root + properties: + pr_1: + type: map + entry_schema: + type: boolean + pr_2: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - equal: fgh + pr_3: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_than: a + pr_4: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_or_equal: b + pr_5: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_than: z + pr_6: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_or_equal: y + pr_7: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - in_range: + - bb + - yy + pr_8: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - valid_values: + - dd + - rr + pr_9: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - length: 3 + pr_10: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_11: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_12: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - max_length: 3 + pr_13: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - pattern: '[a-z]' diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml new file mode 100644 index 0000000000..a15f36899f --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml @@ -0,0 +1,83 @@ +datatype_test: + derived_from: tosca.datatypes.Root + properties: + pr_1: + type: map + entry_schema: + type: boolean + pr_2: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - equal: fgh + pr_3: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_than: a + pr_4: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - greater_or_equal: b + pr_5: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_than: z + pr_6: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - less_or_equal: y + pr_7: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - in_range: + - bb + - yy + pr_8: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - valid_values: + - dd + - rr + pr_9: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - length: 3 + pr_10: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_11: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - min_length: 3 + pr_12: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - max_length: 3 + pr_13: + type: string + description: Globally unique identifier of the VNFD + required: true + constraints: + - pattern: '[a-z]' diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/schema.json b/catalog-be/src/test/resources/yamlValidation/noValid/schema.json new file mode 100644 index 0000000000..df43dc4fe3 --- /dev/null +++ b/catalog-be/src/test/resources/yamlValidation/noValid/schema.json @@ -0,0 +1,121 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "title": "Root Schema", + "type": "object", + "default": {}, + "properties": { + "tosca_definitions_version": { + "title": "The tosca_definitions_version Schema", + "type": "string", + "default": "" + }, + "data_types": { + "title": "The data_types Schema", + "type": "object", + "default": {}, + "required": [], + "additionalProperties": { + "title": "The additionalProperties Schema", + "type": "object", + "default": {}, + "required": [ + "derived_from", + "properties" + ], + "properties": { + "derived_from": { + "title": "The derived_from Schema", + "type": "string", + "default": "" + }, + "properties": { + "title": "The properties Schema", + "type": "object", + "default": {}, + "required": [], + "additionalProperties": { + "title": "The additionalProperties Schema", + "type": "object", + "default": {}, + "required": [ + "type" + ], + "properties": { + "type": { + "title": "The type Schema", + "type": "string", + "default": "" + }, + "description": { + "title": "The description Schema", + "type": "string", + "default": "" + }, + "default": { + "title": "The default Schema", + "type": [ + "string", + "integer", + "boolean", + "number" + ], + "default": "" + }, + "required": { + "title": "The required Schema", + "type": "boolean", + "default": false + }, + "status": { + "title": "The status Schema", + "type": "string", + "default": "" + }, + "constraints": { + "title": "The constraints Schema", + "type": [ + "array" + ], + "default": {} + }, + "entry_schema": { + "title": "The entry_schema Schema", + "type": "object", + "default": {}, + "properties": { + "type": { + "title": "The type Schema", + "type": [ + "string", + "integer", + "boolean", + "number" + ], + "default": "" + } + } + } + }, + "if": { + "properties": { + "type": { + "enum": [ + "map", + "list" + ] + } + } + }, + "then": { + "required": [ + "entry_schema" + ] + } + } + } + } + } + } + } +} |