Skip to content

JSON Schema version? #13

Open
Open
@delaneyj

Description

@delaneyj

I'd like to enable auto completion tooling in VSCode. Do you know if there is a JSON Schema DraftV7 version of the JTD definition? I know it seems like at odd ask but would make editing and validating schema in an IDE on a team much easier.

I had started one but then thought I'd reach out first

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$comment": "A JSON Schema for a JSON Type Definition RFC 8927",
  "title": "JSON Type Definition",
  "definitions": {
    "empty": {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    },
    "type": {
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "boolean",
            "string",
            "timestamp",
            "float32",
            "float64",
            "int8",
            "uint8",
            "int16",
            "uint16",
            "int32",
            "uint32"
          ]
        }
      },
      "required": ["properties"],
      "additionalProperties": false
    },
    "enum": {
      "type": "object",
      "properties": {
        "enum": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        }
      },
      "required": ["enum"],
      "additionalProperties": false
    },
    "elements": {
      "type": "object",
      "properties": {
        "elements": { "$ref": "#/definitions/schema" }
      },
      "required": ["elements"],
      "additionalProperties": false
    },
    "properties": {
      "type": "object",
      "properties": {
        "properties": {
          "type": "object",
          "additionalProperties": { "$ref": "#/definitions/schema" }
        },
        "optionalProperties": {
          "type": "object",
          "additionalProperties": { "$ref": "#/definitions/schema" }
        },
        "additionalProperties": { "type": "boolean", "default": false }
      },
      "required": ["properties"],
      "additionalProperties": false
    },
    "values": {
      "type": "object",
      "properties": {
        "values": { "$ref": "#/definitions/schema" }
      },
      "required": ["values"],
      "additionalProperties": false
    },
    "discriminator": {
      "type": "object",
      "properties": {
        "discriminator": {
          "type": "string"
        },
        "mapping": {
          "type": "object",
          "additionalProperties": { "$ref": "#/definitions/schema" }
        }
      },
      "required": ["discriminator", "mapping"],
      "additionalProperties": false
    },
    "ref": {
      "type": "object",
      "properties": {
        "ref": { "type": "string" }
      },
      "required": ["ref"],
      "additionalProperties": false
    },
    "schema": {
      "oneOf": [
        { "$ref": "#/definitions/empty" },
        { "$ref": "#/definitions/type" },
        { "$ref": "#/definitions/enum" },
        { "$ref": "#/definitions/elements" },
        { "$ref": "#/definitions/properties" },
        { "$ref": "#/definitions/values" },
        { "$ref": "#/definitions/discriminator" },
        { "$ref": "#/definitions/ref" }
      ]
    }
  },

  "type": "object",
  "properties": {
    "definitions": {
      "type": "object",
      "additionalProperties": { "$ref": "#/definitions/schema" }
    }
  },
  "additionalProperties": {
    "$ref": "#/definitions/schema"
  }
}

Activity

ucarion

ucarion commented on Oct 11, 2022

@ucarion
Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @delaneyj@ucarion

        Issue actions

          JSON Schema version? · Issue #13 · jsontypedef/json-typedef-spec