fix: recursively resolve and dereference extended refs #45
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.
(tests don't pass, not ready to merge, see description)
Motivation and Context
Resolves #44
This is blocking my usage of this library, and I don't have any other workaround besides writing my own custom resolving or dereferencing.
Description
else
so that the crawl recurses into the children of an object even if it has a $ref.Unfortunately there's also a bug in dereferencing, and I've tried to fix it, but the dereferencing recursion is more complicated and I wasn't able to figure it out on my own. This would need attention from a maintainer to fix it.
Specifically the new test fails with
MissingPointerError: at "#/local", token "$defs" in "#/$defs/local" does not exist
And in
lib/dereference.js:dereference$Ref
the path is wrong. The log statement (currently commented out) incorrectly says(note that
referenced-root.yaml#/local
doesn't exist)If you remove the top level
$ref: "referenced-root.yaml"
fromtest/specs/nested-extended/nested-extended.yaml
(so it's not an extended ref anymore), that same log says (correctly)I tried to fix this, but I didn't understand enough about how paths are made and what they mean. Someone who's more familiar with the code would need to fix
dereference.js
so that the new test passes.How Has This Been Tested?
Screenshot(s)/recordings(s)
Types of changes
This is a behavior change, so could potentially be considered breaking, but I think it still falls under "bug fix".
Checklist