-
-
Notifications
You must be signed in to change notification settings - Fork 592
Incorrect validation of valid payload with valid schema #1362
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
Comments
Hi there! It'd help a bit (and make it more likely I can look at this) if you minimize your example to be the smallest possible schema + instance which exhibits the issue (by removing things irrelevant to the error and doing things like moving your schema to be inline in the Python file rather than in multiple files). Anything's possible, though both this library and boon pass all of the test suite so if there's an issue our first step will be to minimize it so we can add a test to the suite. |
Here is the smallest repro I managed to make:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "base.json",
"type": "object",
"additionalProperties": false,
"properties": {
"data": {
"$dynamicRef": "#concreteData"
}
},
"required": [
"data"
],
"$defs": {
"data": {
"not": true,
"$dynamicAnchor": "concreteData"
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "camera.json",
"$ref": "base.json",
"$defs": {
"data": {
"$dynamicAnchor": "concreteData",
"type": "object",
"additionalProperties": false,
"properties": {
"cameraFrameSize": {
"$ref": "#/$defs/size"
}
},
"required": [
"cameraFrameSize"
]
},
"size": {
"type": "integer"
}
}
}
{
"data": {
"cameraFrameSize": 1920
}
} The exception is now:
Boon successfully validates the payload. |
I have a schema that heavily utilises
$dynamicRef
to inject parts of schema from other files.Namely, here is the base schema:
base.json
:And here is the specific JSON that fills in the data for the base:
camera.json
:Here is the JSON that I'm trying to validate:
Here is how I'm doing the validation:
The validation fails with exception:
Which is incorrect, as
camera.json
does contain/$defs/size
. I've tried validating the payload with a different validator and it validates the payload successfully.I don't see anything wrong with my schema definitions and boon has no problem validating the payload.
Is this a bug in
jsonschema
library or did I do something wrong andboon
fails to detect it?The text was updated successfully, but these errors were encountered: