Skip to content

Commit

Permalink
Improve type meta-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesrosiers committed Aug 2, 2024
1 parent 6eeca3e commit 93f13e4
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 30 deletions.
18 changes: 12 additions & 6 deletions draft-04/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,19 @@ of valid schemas written for this particular dialect.`
"description": _enum.description
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
"type": ["string", "array"],
"allOf": [
{
"if": { "type": "string" },
"then": { "$ref": "#/definitions/simpleTypes" }
},
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
"if": { "type": "array" },
"then": {
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
}
],
"description": type.description
Expand Down
18 changes: 12 additions & 6 deletions draft-06/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,19 @@ of valid schemas written for this particular dialect.`
"description": _enum.description
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
"type": ["string", "array"],
"allOf": [
{
"if": { "type": "string" },
"then": { "$ref": "#/definitions/simpleTypes" }
},
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
"if": { "type": "array" },
"then": {
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
}
],
"description": type.description
Expand Down
18 changes: 12 additions & 6 deletions draft-07/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,19 @@ of valid schemas written for this particular dialect.`
"description": _enum.description
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
"type": ["string", "array"],
"allOf": [
{
"if": { "type": "string" },
"then": { "$ref": "#/definitions/simpleTypes" }
},
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
"if": { "type": "array" },
"then": {
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
}
],
"description": type.description
Expand Down
18 changes: 12 additions & 6 deletions draft-2019-09/meta/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ export default {
"description": _enum.description
},
"type": {
"anyOf": [
{ "$ref": "#/$defs/simpleTypes" },
"type": ["string", "array"],
"allOf": [
{
"type": "array",
"items": { "$ref": "#/$defs/simpleTypes" },
"minItems": 1,
"uniqueItems": true
"if": { "type": "string" },
"then": { "$ref": "#/$defs/simpleTypes" }
},
{
"if": { "type": "array" },
"then": {
"items": { "$ref": "#/$defs/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
}
],
"description": type.description
Expand Down
18 changes: 12 additions & 6 deletions draft-2020-12/meta/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ export default {
"description": _enum.description
},
"type": {
"anyOf": [
{ "$ref": "#/$defs/simpleTypes" },
"type": ["string", "array"],
"allOf": [
{
"type": "array",
"items": { "$ref": "#/$defs/simpleTypes" },
"minItems": 1,
"uniqueItems": true
"if": { "type": "string" },
"then": { "$ref": "#/$defs/simpleTypes" }
},
{
"if": { "type": "array" },
"then": {
"items": { "$ref": "#/$defs/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
}
],
"description": type.description
Expand Down

0 comments on commit 93f13e4

Please sign in to comment.