-
-
Notifications
You must be signed in to change notification settings - Fork 324
re-unite meta-schema #1610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
re-unite meta-schema #1610
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,191 @@ | ||||||||||
{ | ||||||||||
"$schema": "https://json-schema.org/version/year/meta", | ||||||||||
"$id": "https://json-schema.org/version/year/meta", | ||||||||||
"$dynamicAnchor": "meta", | ||||||||||
|
||||||||||
"title": "JSON Schema Core and Validation specification meta-schema", | ||||||||||
"type": ["object", "boolean"], | ||||||||||
"properties": { | ||||||||||
"$id": { | ||||||||||
"$ref": "#/$defs/iriReferenceString", | ||||||||||
"$comment": "Fragments not allowed.", | ||||||||||
"pattern": "^[^#]*$" | ||||||||||
}, | ||||||||||
"$schema": { "$ref": "#/$defs/iriString" }, | ||||||||||
"$ref": { "$ref": "#/$defs/iriReferenceString" }, | ||||||||||
"$anchor": { "$ref": "#/$defs/anchorString" }, | ||||||||||
"$dynamicRef": { "$ref": "#/$defs/iriReferenceString" }, | ||||||||||
"$dynamicAnchor": { "$ref": "#/$defs/anchorString" }, | ||||||||||
"$comment": { | ||||||||||
"type": "string" | ||||||||||
}, | ||||||||||
"$defs": { | ||||||||||
"type": "object", | ||||||||||
"additionalProperties": { "$dynamicRef": "#meta" } | ||||||||||
}, | ||||||||||
"title": { | ||||||||||
"type": "string" | ||||||||||
}, | ||||||||||
"description": { | ||||||||||
"type": "string" | ||||||||||
}, | ||||||||||
"default": true, | ||||||||||
"deprecated": { | ||||||||||
"type": "boolean", | ||||||||||
"default": false | ||||||||||
}, | ||||||||||
"readOnly": { | ||||||||||
"type": "boolean", | ||||||||||
"default": false | ||||||||||
}, | ||||||||||
"writeOnly": { | ||||||||||
"type": "boolean", | ||||||||||
"default": false | ||||||||||
}, | ||||||||||
"examples": { | ||||||||||
"type": "array", | ||||||||||
"items": true | ||||||||||
}, | ||||||||||
"prefixItems": { "$ref": "#/$defs/schemaArray" }, | ||||||||||
"items": { "$dynamicRef": "#meta" }, | ||||||||||
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, | ||||||||||
"minContains": { | ||||||||||
"$ref": "#/$defs/nonNegativeInteger", | ||||||||||
"default": 1 | ||||||||||
}, | ||||||||||
"contains": { "$dynamicRef": "#meta" }, | ||||||||||
"additionalProperties": { "$dynamicRef": "#meta" }, | ||||||||||
"properties": { | ||||||||||
"type": "object", | ||||||||||
"additionalProperties": { "$dynamicRef": "#meta" }, | ||||||||||
"default": {} | ||||||||||
}, | ||||||||||
"patternProperties": { | ||||||||||
"type": "object", | ||||||||||
"additionalProperties": { "$dynamicRef": "#meta" }, | ||||||||||
"propertyNames": { "format": "regex" }, | ||||||||||
"default": {} | ||||||||||
}, | ||||||||||
"dependentSchemas": { | ||||||||||
"type": "object", | ||||||||||
"additionalProperties": { "$dynamicRef": "#meta" }, | ||||||||||
"default": {} | ||||||||||
}, | ||||||||||
"propertyNames": { "$dynamicRef": "#meta" }, | ||||||||||
"if": { "$dynamicRef": "#meta" }, | ||||||||||
"then": { "$dynamicRef": "#meta" }, | ||||||||||
"else": { "$dynamicRef": "#meta" }, | ||||||||||
"allOf": { "$ref": "#/$defs/schemaArray" }, | ||||||||||
"anyOf": { "$ref": "#/$defs/schemaArray" }, | ||||||||||
"oneOf": { "$ref": "#/$defs/schemaArray" }, | ||||||||||
"not": { "$dynamicRef": "#meta" }, | ||||||||||
"unevaluatedItems": { "$dynamicRef": "#meta" }, | ||||||||||
"unevaluatedProperties": { "$dynamicRef": "#meta" }, | ||||||||||
"type": { | ||||||||||
"anyOf": [ | ||||||||||
{ "$ref": "#/$defs/simpleTypes" }, | ||||||||||
{ | ||||||||||
"type": "array", | ||||||||||
"items": { "$ref": "#/$defs/simpleTypes" }, | ||||||||||
"minItems": 1, | ||||||||||
"uniqueItems": true | ||||||||||
} | ||||||||||
] | ||||||||||
}, | ||||||||||
"const": true, | ||||||||||
"enum": { | ||||||||||
"type": "array", | ||||||||||
"items": true | ||||||||||
}, | ||||||||||
"multipleOf": { | ||||||||||
"type": "number", | ||||||||||
"exclusiveMinimum": 0 | ||||||||||
}, | ||||||||||
"maximum": { | ||||||||||
"type": "number" | ||||||||||
}, | ||||||||||
"exclusiveMaximum": { | ||||||||||
"type": "number" | ||||||||||
}, | ||||||||||
"minimum": { | ||||||||||
"type": "number" | ||||||||||
}, | ||||||||||
"exclusiveMinimum": { | ||||||||||
"type": "number" | ||||||||||
}, | ||||||||||
"maxLength": { "$ref": "#/$defs/nonNegativeInteger" }, | ||||||||||
"minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, | ||||||||||
"pattern": { | ||||||||||
"type": "string", | ||||||||||
"format": "regex" | ||||||||||
}, | ||||||||||
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, | ||||||||||
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, | ||||||||||
"uniqueItems": { | ||||||||||
"type": "boolean", | ||||||||||
"default": false | ||||||||||
}, | ||||||||||
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, | ||||||||||
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, | ||||||||||
"required": { "$ref": "#/$defs/stringArray" }, | ||||||||||
"dependentRequired": { | ||||||||||
"type": "object", | ||||||||||
"additionalProperties": { | ||||||||||
"$ref": "#/$defs/stringArray" | ||||||||||
} | ||||||||||
}, | ||||||||||
"format": { "type": "string" }, | ||||||||||
"contentEncoding": { "type": "string" }, | ||||||||||
"contentMediaType": { "type": "string" }, | ||||||||||
"contentSchema": { "$dynamicRef": "#meta" }, | ||||||||||
|
||||||||||
"$vocabulary": { | ||||||||||
"$comment": "Proposed keyword: https://github.com/json-schema-org/json-schema-spec/blob/main/specs/proposals/vocabularies.md" | ||||||||||
}, | ||||||||||
"propertyDependencies": { | ||||||||||
"$comment": "Proposed keyword: https://github.com/json-schema-org/json-schema-spec/blob/main/specs/proposals/propertyDependencies.md" | ||||||||||
} | ||||||||||
}, | ||||||||||
"patternProperties": { | ||||||||||
"^x-": true, | ||||||||||
"^(?!(?:\\$id|\\$schema|\\$ref|\\$anchor|\\$dynamicRef|\\$dynamicAnchor|\\$comment|\\$defs)$)\\$.*": false | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this superfluous? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Karen suggested an improvement. It's needed. The updated spec restricts the definition of custom There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the meta-schema should adhere to jsonschema-core's "given the high disparity in regular expression constructs support, schema authors SHOULD limit themselves to the following regular expression tokens: ...". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch. Maybe this is one of those requirements where we just don't enforce it with the meta-schema. I'm okay with that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would you be willing to do it with
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gibson042 Thanks for the clever suggestion, but that solution doesn't work well with extensions and {
"$ref": "https://json-schema.org/1/2025",
"properties": {
"foo": { "type": "number" },
"$foo": { "type": "number" }
},
"unevaluatedProperties": false
}
We can get around this problem by using double negation to drop annotations, "not": {
"not": {
"patternProperties": {
"^[^$]|^\\$(id|schema|ref|anchor|dynamicRef|dynamicAnchor|comment|defs)$": true
},
"additionalProperties": false
}
}, But, error messaging with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think this would work, "propertyNames": {
"pattern": "^[^$]|^\\$(id|schema|ref|anchor|dynamicRef|dynamicAnchor|comment|defs)$"
}, It doesn't interfere with |
||||||||||
}, | ||||||||||
"$defs": { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This appears to be missing a definition for "stringArray". |
||||||||||
"anchorString": { | ||||||||||
"type": "string", | ||||||||||
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" | ||||||||||
}, | ||||||||||
"iriString": { | ||||||||||
"type": "string", | ||||||||||
"format": "iri" | ||||||||||
}, | ||||||||||
"iriReferenceString": { | ||||||||||
"type": "string", | ||||||||||
"format": "iri-reference" | ||||||||||
}, | ||||||||||
"nonNegativeInteger": { | ||||||||||
"type": "integer", | ||||||||||
"minimum": 0 | ||||||||||
}, | ||||||||||
"nonNegativeIntegerDefault0": { | ||||||||||
"$ref": "#/$defs/nonNegativeInteger", | ||||||||||
"default": 0 | ||||||||||
}, | ||||||||||
"schemaArray": { | ||||||||||
"type": "array", | ||||||||||
"minItems": 1, | ||||||||||
"items": { "$dynamicRef": "#meta" } | ||||||||||
}, | ||||||||||
"simpleTypes": { | ||||||||||
"enum": [ | ||||||||||
"array", | ||||||||||
"boolean", | ||||||||||
"integer", | ||||||||||
"null", | ||||||||||
"number", | ||||||||||
"object", | ||||||||||
"string" | ||||||||||
] | ||||||||||
} | ||||||||||
} | ||||||||||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's "meta"? (Sorry if it's something we discussed and I forgot.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what's the reason for using a placeholder for "version" and "year"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was late. It should just be
/version/year
It's not published yet. Just wanted to communicate the idea.