CIMAC-CIDC/cidc-schemas

View on GitHub
cidc_schemas/metaschema/strict_meta_schema.json

Summary

Maintainability
Test Coverage
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "strict_meta_schema",
  "title": "Strict meta-schema",
  "type": ["object", "boolean"],
  "oneOf": [
    { "required": ["$ref"] },
    { "required": ["const"] },
    {
      "not": {
        "$comment": "this makes additionalProperties or inheritableBase required only for object-describing schemas",
        "anyOf": [
          {
            "properties": {
              "type": {
                "const": "object"
              }
            }
          },
          { "required": ["properties"] }
        ]
      }
    },
    {
      "type": "object",
      "required": ["additionalProperties"],
      "not": {
        "required": ["inheritableBase"],
        "$comment": "'not' disallows matching this, making additionalProperties and inheritableBase mutually exclusive"
      }
    },
    {
      "type": "object",
      "not": {
        "required": ["additionalProperties"],
        "$comment": "'not' disallows matching this, making additionalProperties and inheritableBase mutually exclusive"
      },
      "required": ["inheritableBase"]
    }
  ],
  "properties": {
    "additionalProperties": {
      "$comment": "overrides draft-07 definition",
      "enum": [
          false,
          true
      ]
    },
    "inheritableBase": {
      "$comment": "Shows that a schema is an extensible 'abstract base' to inherit from and doesn't have `additionalProperties` set to false. No end user objects should be of that schema, only of something 'descendant' from it.",
      "const": true
    },
    "example": {
      "type": "string"
    },
    "in_doc_ref_pattern": {
      "$comment": "used in prism custom validator for in doc refs integrity",
      "type": "string"
    },

    "mergeStrategy": { "$comment": "jsonmerge specific" },
    "mergeOptions": { "$comment": "jsonmerge specific" },

    "$schema": {
      "$comment": "overrides draft-07 definition to point to this strict schema",
      "const": "metaschema/strict_meta_schema.json#"
    },
    "additionalItems": {
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "$ref": "#"
    },
    "items": {
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "$ref": "#"
    },
    "definitions": {
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "additionalProperties": { "$ref": "#" }
    },
    "properties": {
      "type": "object",
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "additionalProperties": { "$ref": "#" }
    },
    "patternProperties": false,
    "dependencies": {
      "type": "object",
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "additionalProperties": {
        "anyOf": [
          { "$ref": "#" },
          {
            "$ref": "http://json-schema.org/draft-07/schema#/definitions/stringArray"
          }
        ]
      }
    },

    "$id": {
      "type": "string",
      "format": "uri-reference"
    },
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "$ref": {
      "type": "string",
      "format": "uri-reference"
    },
    "$comment": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "default": true,
    "readOnly": {
      "type": "boolean",
      "default": false
    },
    "examples": {
      "type": "array",
      "items": true
    },
    "multipleOf": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "maximum": {
      "type": "number"
    },
    "exclusiveMaximum": {
      "type": "number"
    },
    "minimum": {
      "type": "number"
    },
    "exclusiveMinimum": {
      "type": "number"
    },
    "maxLength": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
    },
    "minLength": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
    },
    "pattern": {
      "type": "string",
      "format": "regex"
    },
    "maxItems": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
    },
    "minItems": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
    },
    "uniqueItems": {
      "type": "boolean",
      "default": false
    },
    "contains": { "$ref": "#" },
    "maxProperties": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
    },
    "minProperties": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
    },
    "required": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/stringArray"
    },
    "propertyNames": { "$ref": "#" },
    "const": true,
    "enum": {
      "type": "array",
      "items": true
    },
    "type": {
      "anyOf": [
        {
          "$ref": "http://json-schema.org/draft-07/schema#/definitions/simpleTypes"
        },
        {
          "type": "array",
          "items": {
            "$ref": "http://json-schema.org/draft-07/schema#/definitions/simpleTypes"
          },
          "minItems": 1,
          "uniqueItems": true
        }
      ]
    },
    "encrypt": {
      "type": "boolean",
      "default": false
    },
    "format": { "type": "string" },
    "contentMediaType": { "type": "string" },
    "contentEncoding": { "type": "string" },

    "if": { "$ref": "http://json-schema.org/draft-07/schema#" },
    "then": { "$ref": "http://json-schema.org/draft-07/schema#" },
    "else": { "$ref": "http://json-schema.org/draft-07/schema#" },
    "allOf": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/schemaArray"
    },
    "anyOf": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/schemaArray"
    },
    "oneOf": {
      "$ref": "http://json-schema.org/draft-07/schema#/definitions/schemaArray"
    },
    "not": { "$ref": "http://json-schema.org/draft-07/schema#" }
  },
  "definitions": {
    "schemaArray": {
      "$comment": "overrides draft-07 definition to make self ref link point to this strict schema",
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#" }
    }
  },
  "additionalProperties": false
}