Skip to content

Commit

Permalink
rf(metaschema): Define object types, including identifying JSON schem…
Browse files Browse the repository at this point in the history
…a subtypes
  • Loading branch information
effigies committed Jul 13, 2024
1 parent 1f745e6 commit 001a849
Showing 1 changed file with 116 additions and 186 deletions.
302 changes: 116 additions & 186 deletions src/metaschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,42 +84,19 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/type"
},
"format": { "$ref": "#/definitions/formats" },
"pattern": {
"type": "string"
},
"unit": {
"type": "string"
},
"enum": {
"type": "array"
},
"anyOf": {
"$ref": "http://json-schema.org/draft/2020-12/meta/applicator#/properties/anyOf"
},
"maximum": {
"type": "number"
},
"minimum": {
"type": "number"
"allOf": [
{ "$ref": "#/definitions/schemaTerm" },
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/nameValueTerm" },
{
"type": "object",
"properties": {
"format": { "$ref": "#/definitions/formats" },
"unit": { "type": "string" }
}
}
},
"required": ["name", "display_name"],
"additionalProperties": false
],
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -128,17 +105,8 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["display_name", "description"],
"additionalProperties": false
"$ref": "#/definitions/generalTerm",
"unevaluatedProperties": false
},
"additionalProperties": false
}
Expand All @@ -147,20 +115,11 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["value", "display_name", "description"],
"additionalProperties": false
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/valueTerm" }
],
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -169,85 +128,50 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/type"
},
"format": { "$ref": "#/definitions/formats" },
"enum": {
"type": "array"
"allOf": [
{ "$ref": "#/definitions/schemaTerm" },
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/nameValueTerm" },
{
"type": "object",
"properties": {
"format": { "$ref": "#/definitions/formats" }
},
"required": ["format"]
}
},
"required": [
"name",
"display_name",
"description",
"type",
"format"
],
"additionalProperties": false
"unevaluatedProperties": false
}
},
"additionalProperties": false
},
"enums": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"type": "object",
"properties": {
"type": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/type"
},
"enum": {
"type": "array"
},
"value": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
},
"tags": {
"type": "array"
}
},
"additionalProperties": false
}
"^[a-zA-Z0-9][a-zA-Z0-9_-]*$": {
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/valueTerm" },
{ "properties": { "tags": { "type": "array" } } }
]
},
"^_[a-zA-Z0-9_-]+$": {
"$ref": "http://json-schema.org/draft/2020-12/schema#",
"required": ["type", "enum"]
},
"unevaluatedProperties": false
},
"additionalProperties": false
},
"extensions": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["display_name", "description", "value"],
"additionalProperties": false
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/valueTerm" }
],
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -256,20 +180,14 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"file_type": {
"type": "string"
},
"description": {
"type": "string"
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{
"properties": { "file_type": { "type": "string" } },
"required": ["file_type"]
}
},
"required": ["display_name", "file_type", "description"],
"additionalProperties": false
],
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -278,41 +196,38 @@
"type": "object",
"propertyNames": { "$ref": "#/definitions/formats" },
"additionalProperties": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"description": {
"type": "string"
},
"pattern": {
"format": "regex"
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{
"properties": {
"pattern": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/pattern"
}
},
"required": ["pattern"]
}
},
"required": ["display_name", "description", "pattern"]
],
"unevaluatedProperties": false
}
},
"metadata": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/type"
"allOf": [
{ "$ref": "#/definitions/schemaTerm" },
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/nameValueTerm" },
{
"properties": {
"recommended": {
"$ref": "http://json-schema.org/draft/2020-12/meta/validation#/properties/required"
},
"unit": { "type": "string" }
}
}
},
"required": ["name", "display_name", "description"]
],
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -321,17 +236,8 @@
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["display_name", "description"],
"additionalProperties": false
"$ref": "#/definitions/generalTerm",
"unevaluatedProperties": false
}
},
"additionalProperties": false
Expand All @@ -340,19 +246,21 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"type": "string"
"allOf": [
{ "$ref": "#/definitions/generalTerm" },
{ "$ref": "#/definitions/valueTerm" },
{
"properties": {
"unit": { "type": "string" },
"anyOf": {
"$ref": "http://json-schema.org/draft/2020-12/meta/applicator#/properties/anyOf"
},
"maxValue": { "type": "number" },
"minValue": { "type": "number" }
}
}
},
"required": ["value", "display_name", "description"]
],
"unevaluatedProperties": false
},
"additionalProperties": false
}
Expand Down Expand Up @@ -622,6 +530,28 @@
"uri"
]
},
"generalTerm": {
"type": "object",
"properties": {
"display_name": { "type": "string" },
"description": { "type": "string" }
},
"required": ["display_name", "description"]
},
"schemaTerm": {
"$ref": "http://json-schema.org/draft/2020-12/schema#",
"anyOf": [{ "required": ["type"] }, { "required": ["anyOf"] }]
},
"nameValueTerm": {
"type": "object",
"properties": { "name": { "type": "string" } },
"required": ["name"]
},
"valueTerm": {
"type": "object",
"properties": { "value": { "type": "string" } },
"required": ["value"]
},
"entities": {
"type": "object",
"patternProperties": {
Expand Down

0 comments on commit 001a849

Please sign in to comment.