feat: resolve $dynamicRef against the dynamic scope#504
Open
aqeelat wants to merge 1 commit into
Open
Conversation
…ferencing locallyDereferenced() / dereferenced(in:) now resolve $dynamicRef against the dynamic scope (outermost $dynamicAnchor wins, per JSON Schema 2020-12). Non-recursive targets are inlined; recursive or unresolvable dynamic refs throw, consistent with static $ref cycles and the Dereferenced... invariant (a DereferencedJSONSchema must not contain references). Implements the 'dynamic-scope-aware dereferencing' item from mattpolzin#359. Edits the same migration-guide section as mattpolzin#503 (external deref); reconcile on merge. Part of mattpolzin#359.
cbba88a to
26b74d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #359.
Implements the "dynamic-scope-aware dereferencing" item from the #359 task list.
locallyDereferenced()/JSONSchema.dereferenced(in:)now resolve$dynamicRefagainst the dynamic scope (the outermost in-scope$dynamicAnchorwins, per JSON Schema 2020-12 §7.7), instead of throwing on every$dynamicRef.Behavior
$dynamicRef(e.g. the JSON Schema "generics" pattern —$dynamicRef "#T"→ a leaf$defsentry): the target is inlined.$dynamicRef: throws (ReferenceCycleError/GenericError), consistent with how recursive static$refalready fails and with theDereferenced...invariant that aDereferencedJSONSchemacontains no references.$dynamicAnchor(and$defs-declared anchors, first-wins/outermost-wins) and threaded through subschemas and across$refboundaries.Notes
swift-openapi-generator) are unaffected —.dynamicReferenceonJSONSchemais unchanged; onlylocallyDereferenced()behavior changes (strictly an improvement: previously it threw on all$dynamicRef; now only recursive/unresolvable ones).$dynamicRef#503 (external deref); trivial doc reconcile on merge.Testing
$ref,$ref→$dynamicRefname propagation, optional$refproperty..referencerefactor is behavior-preserving).llvm-cov-verified: 0 uncovered regions in the scope-aware_dereferenced+ theArrayContext/ObjectContextthreading).This PR was drafted with assistance from AI tooling. The submitter has reviewed and validated the contents prior to submission.