-
-
Notifications
You must be signed in to change notification settings - Fork 311
proposal to add keyword metadata to vocabularies by defining a new vocabulary #1257
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
005eb0a
proposal to add keyword metadata to vocabularies by defining a new vo…
gregsdennis 56cb798
set the vocab vocab requirement to false
gregsdennis 390c728
the value of producedValue is a schema
gregsdennis 39aaea7
remove trailing commas
gregsdennis 6ae0b07
use vocab metaschemas right
gregsdennis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/next/schema", | ||
"$id": "https://json-schema.org/draft/next/meta/vocabulary", | ||
"$vocabulary": { | ||
"https://json-schema.org/draft/next/vocab/core": true, | ||
"https://json-schema.org/draft/next/vocab/vocabulary": false | ||
}, | ||
|
||
"title": "Vocabulary meta-data vocabulary meta-schema", | ||
"description": "Defines keywords for use in vocabulary meta-schemas to provide additional information for their keywords", | ||
"type": [ "object", "boolean" ], | ||
"properties": { | ||
"applicators": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"oneOf": [ | ||
{"$ref": "#/$defs/applicatorKind"}, | ||
{ | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/applicatorKind" }, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
] | ||
} | ||
}, | ||
"assertions": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
}, | ||
"annotations": { | ||
"type": "object", | ||
"properties": { | ||
"kind": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"oneOf": [ | ||
{ "$ref": "#/$defs/annotationKind" }, | ||
{ | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/annotationKind" }, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
] | ||
} | ||
}, | ||
"producedValue": { "$dynamicRef": "#meta" } | ||
}, | ||
"required": [ "kind" ] | ||
} | ||
}, | ||
"annotations": { | ||
"applicators": { "kind": "producer" }, | ||
"assertions": { "kind": "producer" }, | ||
"annotations": { "kind": "producer" } | ||
}, | ||
"$defs": { | ||
"applicatorKind": { | ||
"enum": [ "objectChild", "arrayChild", "inPlace" ] | ||
}, | ||
"annotationKind": { | ||
"enum": [ "producer", "collector" ] | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This says that schemas using
https://json-schema.org/draft/next/meta/applicator
as a meta-schema are able to use the vocabulary vocabulary, which I don't think is what you mean. You need this meta-schema's meta-schema (currently declared ashttps://json-schema.org/draft/next/schema
) to include the vocabulary vocabulary in$vocabulary
(buffalo buffalo buffalo buffalo buffalo...). In which case it probably would not be the default meta-schema because most schemas won't need to (and shouldn't) use the vocabulary vocabulary.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.
But if that's just
https://json-schema.org/draft/next/schema
, it doesn't solve the problem you're describing.What I want is for meta-schemas that describe vocabularies to be able to use these new keywords. Does that mean that we need a dedicated vocabulary-describing meta-schema? Then have (e.g.) applicator meta-schema reference that one in
$schema
?So
Then
https://json-schema.org/draft/next/meta/applicator
and friends all have$schema: https://json-schema.org/draft/next/meta/vocabulary
?I think this also provides a pre-packaged meta-schema for other custom vocab meta-schemas to use.
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.
But if it has
$schema: https://json-schema.org/draft/next/schema
then it can't itself use the keywords it defines. So does it need to be its own meta-schema? That line of logic leads us to needing to resolve Keyword for identifying bootstrapping rules #217 first.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.
$vocabulary
is (effectively) an annotation. So when you use it in a meta-schema, it annotates the (non-meta-)schema and says "this schema can use this vocabulary".If this were not the case, then every non-meta-schema would have to declare
$vocabulary
, which would be a mess.So yes, if you want other vocab meta-schemas to use the vocabulary vocabulary (VV), then the VV needs to be in their meta-schema's
$vocabulary
. Since we would not want to put the VV in the default meta-schema, yes that means they would need a different meta-schema.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.
@gregsdennis
At minimum, we need to be able to use any vocabulary description to automatically determine what keywords are part of that vocabulary, which will let us distinguish known keywords from optional (and not directly-supported) vocabularies from completely unknown keywords. Otherwise, it's just JSON-formatted documentation, and that doesn't seem useful to me.
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.
I think this means that you agree with my commented approach.
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.
@gregsdennis yes, I think so (I think I got confused by the next comment after that)