Repository navigation
Resolve $id and $ref inside schema arrays - #235
Open
chinmayajha wants to merge 1 commit into
Open
chinmayajha wants to merge 1 commit into
chinmayajha wants to merge 1 commit into
Conversation
RefResolver.walk only descended into dict values, so subschemas in allOf, anyOf, oneOf and items arrays were never walked: an $id there was not registered, and a relative $ref there was not joined with the base URI of its parent $id. It also walked into const and default values, rewriting a $ref there and registering an $id from data. Walk the keywords that hold subschemas and skip the data keywords. ref.json passes for draft 06 and 07, and id.json for draft 04, 06 and 07.
Author
|
@horejsek could you approve the workflow runs and review this when you have a moment? |
This branch has not been deployed
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.
RefResolver.walkonly went into dict values, so subschemas inallOf,anyOf,oneOfanditemsarrays were never walked. An$idthere was never registered, and a relative$refthere was not joined with the base URI of its parent$id:The walk now follows the keywords that hold subschemas and skips the data keywords (
const,default,enum,examples). Before, a$refinside aconstordefaultvalue was rewritten to an absolute URI, so the const no longer matched its own value._expand_refsin the generator skips the same keywords, so a$refinside data is not resolved when building error messages.With this,
ref.jsonfrom the test suite passes for draft 06 and 07 andid.jsonpasses for draft 04, 06 and 07, so I removed them from the ignore lists. I also added a test intests/test_integration.pyfor a$refinsideconstunder a nested$id, which fails on master. The full suite passes and pylint is unchanged. CHANGELOG has entries under UNRELEASED.