Issue with unevaluatedProperties and allOf and arrays
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
No repository files, tests, or entry points are mentioned. Start by running the provided schemas and instance data through the validator, then isolate how unevaluatedProperties behaves inside the allOf array items. Done means determining whether the reported rejection of Nestedppty is expected or a validator defect, with a focused regression test if it is a defect.
Written by the indexing model from the issue text.
Description
I need to have a schema allowing extra fields only under one specific node (ExtensionProperties).
It works well using "additionalProperties": false with simple schemas:
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"ExtensionProperties": {
"type": "object"
}
}
}
This data is ok
{
"rootppty": "ad",
"ExtensionProperties": {
"whatever": "you want"
}
}
and this one fails validation as expected
{
"rootppty": "ok",
"other": "fail",
"ExtensionProperties": {
"whatever": "you want"
}
}
But when I have some allOf, I need to use "unevaluatedProperties": false as explained in the documentation
It works well with simple schemas
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"data": {
"unevaluatedProperties": false,
"allOf": [{
"type": "object",
"title": "IndividualProperties",
"properties": {
"Nestedppty": {
"type": "string"
}
}
}
]
},
"ExtensionProperties": {
"type": "object"
}
}
}
This data fails the validation as expected (on rootppty2 and Nestedppty2)
{
"rootppty": "ok",
"rootppty2": "fail",
"data": {
"Nestedppty": "ok",
"Nestedppty2": "fail"
},
"ExtensionProperties": {
"whatever": "you want"
}
}
But when I am adding array in the allOf part I am facing issues
This schema does not fail validation on additional fields in the array
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"data": {
"unevaluatedProperties": false,
"allOf": [{
"type": "object",
"title": "IndividualProperties",
"properties": {
"Nestedppty": {
"type": "string"
},
"Nestedarray": {
"type": "array",
"items": {
"unevaluatedProperties": false,
"type": "object",
"properties": {
"additionalProperties": false,
"nestedarrayInternalpty": {
"type": "string"
}
}
}
}
}
}
]
},
"ExtensionProperties": {
"type": "object"
}
}
}
for example this data should fail validation on nestedarrayInternalpty2
{
"rootppty": "ok",
"data": {
"Nestedppty": "ok",
"Nestedarray": [
{"nestedarrayInternalpty": "ok"},
{"nestedarrayInternalpty2": "should fail"}
]
},
"ExtensionProperties": {
"whatever": "you want"
}
}
but it fails also on Nestedppty, which should be ok
Am I doing something wrong or is there an issue when several "unevaluatedProperties": false are nested ?
- Dominant language
- Python
- Stars
- 5k
- Forks
- 741
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-jsonschema/jsonschema
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
python-jsonschema/jsonschema#1610 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
python-jsonschema/jsonschema#1588 · 2 comments ·
Maintainers usually reply within 6 days
-
Iterator error contexts lose parent links and absolute pathsMay be free again @DawnofGenX claimed this 59 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
python-jsonschema/jsonschema#1584 · 3 comments ·
Maintainers usually reply within 6 days
-
regex format checker crashes with RecursionError on deeply nested patternsPossibly taken @DawnofGenX claimed this 59 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-jsonschema/jsonschema#1538 · 1 comment ·
Maintainers usually reply within 6 days
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponentMay be free again A pull request for this issue was closed without being merged. OpenNeeds Test Upstream
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-jsonschema/jsonschema#1511 · 1 comment ·
Maintainers usually reply within 6 days
All issues in python-jsonschema/jsonschema
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
web-push-libs/pywebpush#216 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AgriciDaniel/claude-seo#572 ·
Maintainers usually reply within 5 days
-
area:print-dispatch
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
area: docs domain: technical-writing good first issue type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Deepak3699/Ai_Mentor#919 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day