Implement YAML Validator
[sdc.git] / catalog-be / src / main / resources / validateYaml / schema.json
diff --git a/catalog-be/src/main/resources/validateYaml/schema.json b/catalog-be/src/main/resources/validateYaml/schema.json
new file mode 100644 (file)
index 0000000..df43dc4
--- /dev/null
@@ -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"
+                ]
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}