Skip to content

Conversation

@karenetheridge
Copy link
Member

We $ref from base -> first#/$defs/stuff -> second#/$defs/stuff -> third#/$defs/stuff and then follow a $dynamicRef to #length. At no point do we ever actually evaluate at the root schema for each scope. The dynamic scope is [ base, first, second, third ] and we check the scopes in order, therefore the first scope we find with a dynamic anchor "length" is "second".

This revealed a bug in my implementation, where dynamic scopes were only being recorded while evaluating an $id keyword, but not when using a $ref that went to a sub-resource that lacked an $id.

@karenetheridge karenetheridge requested a review from a team as a code owner November 15, 2025 02:35
…ach schema

We $ref from base -> first#/$defs/stuff -> second#/$defs/stuff ->
third#/$defs/stuff and then follow a $dynamicRef to #length.
At no point do we ever actually evaluate at the root schema for each scope.
The dynamic scope is [ base, first, second, third ] and we check the scopes in order,
therefore the first scope we find with a dynamic anchor "length" is "second".
@karenetheridge karenetheridge force-pushed the ether/dynamic-scopes-subschemas branch from 856ebed to 19810ec Compare November 15, 2025 22:41
karenetheridge added a commit to karenetheridge/JSON-Schema-Modern that referenced this pull request Nov 17, 2025
Dynamic scopes were only being recorded while evaluating an $id keyword, but
if we follow a $ref targeting a sub-resource that lacked an $id but is in a
different namespace, the new scope was never recorded.

See also json-schema-org/JSON-Schema-Test-Suite#794
@jdesrosiers jdesrosiers merged commit a247442 into main Nov 18, 2025
4 checks passed
@jdesrosiers jdesrosiers deleted the ether/dynamic-scopes-subschemas branch November 18, 2025 22:38
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.

4 participants