-
Notifications
You must be signed in to change notification settings - Fork 43
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
Updates schema docs to clarify unevaluatedProperties use #2247
base: main
Are you sure you want to change the base?
Conversation
Are we sure that we are using |
It's kinda flexible, |
Is our validation correct, though? Where in the JSON Schema specification is this described? |
Yea, our validation is correct, here is the docs page https://json-schema.org/understanding-json-schema/reference/object#unevaluatedproperties It's not specified that you need to define it this way, it is just a consequence of including the |
I simply don't see anything in the documentation that suggests that this is valid, or any examples of this usage. Maybe I'm being dense. Would you walk me through this? |
No worries! TLDR: We could replace From our validation script: const schemaId = example['$schema']
if (!schemaId) {
process.exitCode = 1
console.error(`error: ${path}: missing required $schema property`)
return
}
try {
ajv.validate(schemaId, example)
} catch (e) {
...
} In the actual For the examples, we more or less just chose to use that to specify which gcn schema corresponds to an example. We could rename it to "schema" (no "$") or anything else and it would still work as expected, so long as we also update the validation script. So I think technically the correct way of using it would be to include it in the properties and define it as a This somewhat ties into an idea I was working on for a |
Thanks for explaining this to me. I understand, now. As you explained, The governing part of the specification is https://json-schema.org/draft/2020-12/json-schema-core#name-the-schema-keyword:
In other words, the specification calls for JSON Schema to contain a I agree: we should define the Would that base schema be inherited by all of our core schema, or should we ask missions to inherit from it explicitly? |
Description
The listed example included
'unevaluatedProperties':false
but did not include the'$schema': true
property. Any schema that copied this format would fail validation.This updates the docs to be more explicit about how they are tied together