Fix JSON schema resolver bug#2188
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
This PR fixes JSON Schema union (oneOf/anyOf/allOf) validation when a union branch is a $ref whose resolved schema contains further nested $refs, by preserving resolver context during validation.
Changes:
- Update
_validate_subschemasto validate resolved$refsubschemas using a resolver that retains the correct reference context. - Add sync + async regression tests covering nested
$refresolution throughoneOf/anyOf/allOf, including deeper nesting. - Require
jsonschema >= 4.18.0for JSON and example dependency sets.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/confluent_kafka/schema_registry/common/json_schema.py |
Adjusts subschema validation to pass resolver context when validating resolved $ref branches. |
tests/schema_registry/_sync/test_json_serdes.py |
Adds regression tests for nested $ref resolution in union constructs (sync path). |
tests/schema_registry/_async/test_json_serdes.py |
Adds regression tests for nested $ref resolution in union constructs (async path). |
requirements/requirements-json.txt |
Bumps minimum jsonschema version to support the fix. |
requirements/requirements-examples.txt |
Aligns examples dependency set with the new jsonschema minimum. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I will close the PR (#2187) but can we add the PR description here to provide some context |
|




What
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups