Skip to content

Conversation

@clemensv
Copy link
Contributor

Fixes #2

…rging

When importing schemas via $import or $importdefs, internal $ref and
$extends pointers (like #/definitions/Address) were pointing to the
original document's root instead of their new location in the merged document.

This fix adds a _rewrite_refs helper method to both validators that
recursively rewrites these pointers to their new location after import.

For example, when importing at #/definitions/People, a reference like
#/definitions/Address is rewritten to #/definitions/People/Address.

Changes:
- Added _rewrite_refs() method to both validators
- Updated _process_imports() to call ref rewriting with deep copy
- Added 3 new tests for ref rewriting scenarios

Fixes #2
@clemensv clemensv merged commit a25f982 into main Nov 27, 2025
1 check passed
@clemensv clemensv deleted the fix-import-ref-rewriting branch November 27, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not working validator with imports

2 participants