Restructure the json schemas repository
[dcaegen2/platform/cli.git] / component-json-schemas / data-format / dcae-cli-v1 / data-format-schema.json
diff --git a/component-json-schemas/data-format/dcae-cli-v1/data-format-schema.json b/component-json-schemas/data-format/dcae-cli-v1/data-format-schema.json
new file mode 100644 (file)
index 0000000..be15682
--- /dev/null
@@ -0,0 +1,205 @@
+{
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title": "Data format specification schema Version 1.0",
+    "type": "object",
+    "oneOf": [{
+        "properties": {
+            "self": {
+                "$ref": "#/definitions/self"
+            },
+            "dataformatversion": {
+                "$ref": "#/definitions/dataformatversion"
+            },
+            "reference": {
+
+                "type": "object",
+                "description": "A reference to an external schema - name/version is used to access the artifact",
+                "properties": {
+                    "name": {
+                        "$ref": "#/definitions/name"
+                    },
+                    "version": {
+                        "$ref": "#/definitions/version"
+                    },
+                    "format": {
+                        "$ref": "#/definitions/format"
+                    }
+                },
+                "required": [
+                    "name",
+                    "version",
+                    "format"
+                ],
+                "additionalProperties": false
+            }
+        },
+        "required": ["self", "dataformatversion", "reference"],
+        "additionalProperties": false
+    }, {
+        "properties": {
+            "self": {
+                "$ref": "#/definitions/self"
+            },
+            "dataformatversion": {
+                "$ref": "#/definitions/dataformatversion"
+            },
+            "jsonschema": {
+                "$schema": "http://json-schema.org/draft-04/schema#",
+                "description": "The actual JSON schema for this data format"
+            }
+
+        },
+        "required": ["self", "dataformatversion", "jsonschema"],
+        "additionalProperties": false
+    }, {
+        "properties": {
+            "self": {
+                "$ref": "#/definitions/self"
+            },
+            "dataformatversion": {
+                "$ref": "#/definitions/dataformatversion"
+            },
+            "delimitedschema": {
+                "type": "object",
+                "description": "A JSON schema for delimited files",
+                "properties": {
+                    "delimiter": {
+                        "enum": [",", "|", "\t"]
+                    },
+                    "fields": {
+                        "type": "array",
+                        "description": "Array of field descriptions",
+                        "items": {
+                            "$ref": "#/definitions/field"
+                        }
+                    }
+                },
+                "additionalProperties": false
+            }
+        },
+        "required": ["self", "dataformatversion", "delimitedschema"],
+        "additionalProperties": false
+    }, {
+        "properties": {
+            "self": {
+                "$ref": "#/definitions/self"
+            },
+            "dataformatversion": {
+                "$ref": "#/definitions/dataformatversion"
+            },
+            "unstructured": {
+                "type": "object",
+                "description": "A JSON schema for unstructured text",
+                "properties": {
+                    "encoding": {
+                        "type": "string",
+                        "enum": ["ASCII", "UTF-8", "UTF-16", "UTF-32"]
+                    }
+                },
+                "additionalProperties": false
+
+            }
+        },
+        "required": ["self", "dataformatversion", "unstructured"],
+        "additionalProperties": false
+    }],
+    "definitions": {
+        "name": {
+            "type": "string"
+        },
+        "version": {
+            "type": "string",
+            "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$"
+        },
+        "self": {
+            "description": "Identifying Information for the Data Format - name/version can be used to access the artifact",
+            "type": "object",
+            "properties": {
+                "name": {
+                    "$ref": "#/definitions/name"
+                },
+                "version": {
+                    "$ref": "#/definitions/version"
+                },
+                "description": {
+                    "type": "string"
+                }
+            },
+            "required": [
+                "name",
+                "version"
+            ],
+            "additionalProperties": false
+        },
+        "format": {
+            "description": "Reference schema type",
+            "type": "string",
+            "enum": [
+                "JSON",
+                "Delimited Format",
+                "XML",
+                "Unstructured"
+            ]
+        },
+        "field": {
+            "description": "A field definition for the delimited schema",
+            "type": "object",
+            "properties": {
+                "name": {
+                    "type": "string"
+                },
+                "description": {
+                    "type": "string"
+                },
+                "fieldtype": {
+                    "description": "the field type - from the XML schema types",
+                    "type": "string",
+                    "enum": ["string", "boolean",
+                        "decimal", "float", "double",
+                        "duration", "dateTime", "time",
+                        "date", "gYearMonth", "gYear",
+                        "gMonthDay", "gDay", "gMonth",
+                        "hexBinary", "base64Binary",
+                        "anyURI", "QName", "NOTATION",
+                        "normalizedString", "token",
+                        "language", "IDREFS", "ENTITIES",
+                        "NMTOKEN", "NMTOKENS", "Name",
+                        "NCName", "ID", "IDREF", "ENTITY",
+                        "integer", "nonPositiveInteger",
+                        "negativeInteger", "long", "int",
+                        "short", "byte",
+                        "nonNegativeInteger", "unsignedLong",
+                        "unsignedInt", "unsignedShort",
+                        "unsignedByte", "positiveInteger"
+
+                    ]
+                },
+                "fieldPattern": {
+                    "description": "Regular expression that defines the field format",
+                    "type": "integer"
+                },
+                "fieldMaxLength": {
+                    "description": "The maximum length of the field",
+                    "type": "integer"
+                },
+                "fieldMinLength": {
+                    "description": "The minimum length of the field",
+                    "type": "integer"
+                },
+                "fieldMinimum": {
+                    "description": "The minimum numeric value of the field",
+                    "type": "integer"
+                },
+                "fieldMaximum": {
+                    "description": "The maximum numeric value of the field",
+                    "type": "integer"
+                }
+            },
+            "additionalProperties": false
+        },
+        "dataformatversion": {
+            "type": "string",
+            "enum": ["1.0.0"]
+        }
+    }
+}