-
-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Description
According to the JSON Schema specification (https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.1-2), relative meta-schema references are not permitted. We obey this, but in such case (for example when running base_dialect()
), we throw a standard SchemaResolutionError
that can leave some users confused.
For example, consider this case:
{ "$schema": "../meta.json" }
And this meta-schema at the corresponding relative location:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": { "https://json-schema.org/draft/2020-12/vocab/core": true },
"$dynamicAnchor": "meta",
"$ref": "https://json-schema.org/draft/2020-12/meta/core"
}
When running this in the CLI, we would get:
error: Could not resolve the metaschema of the schema
../meta.json
This is likely because you forgot to import such schema using --resolve/-r
Instead, we should have a new SchemaRelativeMetaschemaResolutionError
error (that subclasses SchemaResolutionError
) to better react to this case and present information that the average user can actually understand.
Cases to consider seem to include:
base_dialect()
(for performance reasons, only parse the URI when we are about to throwSchemaResolutionError
)dialect()
(this one probably does not need to check anything and we can rely on its consumers to do so when appropriate)
Metadata
Metadata
Assignees
Labels
No labels