aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-06-28 15:34:47 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-29 10:31:23 +0000
commit2e4af1e0c0611851f450b2e215485064f6795958 (patch)
tree2c766e17841c24dc40faa98ff260234ea2cfa80a /catalog-be/src/main/resources
parent6d4057b032a30daa8388f9f1a323eae1581eb91c (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/main/resources')
-rw-r--r--catalog-be/src/main/resources/config/error-configuration.yaml10
-rw-r--r--catalog-be/src/main/resources/validateYaml/schema.json121
2 files changed, 130 insertions, 1 deletions
diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml
index 7589511f54..d77f98ed28 100644
--- a/catalog-be/src/main/resources/config/error-configuration.yaml
+++ b/catalog-be/src/main/resources/config/error-configuration.yaml
@@ -2886,4 +2886,12 @@ errors:
code: 409,
message: "System deployed %1 cannot be archived. Component: '%2'",
messageId: "SVC4018"
- } \ No newline at end of file
+ }
+
+ #---------SVC4010-----------------------------
+ # %1 - error's list
+ YAML_IS_INVALID: {
+ code: 402,
+ message: "Error: Uploaded YAML file is invalid.\n%1",
+ messageId: "SVC4010"
+ }
diff --git a/catalog-be/src/main/resources/validateYaml/schema.json b/catalog-be/src/main/resources/validateYaml/schema.json
new file mode 100644
index 0000000000..df43dc4fe3
--- /dev/null
+++ b/catalog-be/src/main/resources/validateYaml/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"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}