Skip to content

Add id with ref support, solve bug(371). #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

willson-chen
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #717 into master will increase coverage by 0.68%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #717      +/-   ##
==========================================
+ Coverage   95.25%   95.93%   +0.68%     
==========================================
  Files          18       18              
  Lines        2716     3541     +825     
  Branches      320      545     +225     
==========================================
+ Hits         2587     3397     +810     
- Misses        106      123      +17     
+ Partials       23       21       -2     
Impacted Files Coverage Δ
jsonschema/tests/test_jsonschema_test_suite.py 100.00% <ø> (ø)
jsonschema/validators.py 96.19% <100.00%> (+1.54%) ⬆️
jsonschema/_types.py 100.00% <0.00%> (ø)
jsonschema/tests/_helpers.py 100.00% <0.00%> (ø)
jsonschema/_legacy_validators.py 100.00% <0.00%> (ø)
jsonschema/tests/test_exceptions.py 100.00% <0.00%> (ø)
jsonschema/cli.py 96.99% <0.00%> (+0.04%) ⬆️
jsonschema/_utils.py 94.79% <0.00%> (+0.05%) ⬆️
jsonschema/tests/test_validators.py 98.79% <0.00%> (+0.21%) ⬆️
jsonschema/_validators.py 100.00% <0.00%> (+0.46%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a9852e...f74e322. Read the comment docs.

@willson-chen willson-chen force-pushed the add_id_with_ref_support branch from 985f32d to 434ff64 Compare August 6, 2020 13:46
@willson-chen
Copy link
Contributor Author

willson-chen commented Aug 8, 2020

@Julian Hello, I have tested this PR could solve the following four skipped scenes, at the same time #710 #693 #341 all have been solved.

        or skip(
            message=bug(),
            subject="ref",
            case_description="Recursive references between schemas",
        )(test)
        or skip(
            message=bug(371),
            subject="ref",
            case_description="Location-independent identifier",
        )(test)
        or skip(
            message=bug(371),
            subject="ref",
            case_description=(
                "Location-independent identifier with absolute URI"
            ),
        )(test)
        or skip(
            message=bug(371),
            subject="ref",
            case_description=(
                "Location-independent identifier with base URI change in subschema"
            ),
        )(test)

@WilliamHeaven
Copy link

@Julian This PR can fix some skipped test cases. Could you please check it to see whether it meets the expectation when you have time?


The last URL.
"""
if not isinstance(schema, dict):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have a closer look, but the schema does not have to be a dict (it's an arbitrary collections.Mapping) and does not necessarily even need to be copy-able.

return

for k in schema.keys():
if k in [u"id", u"$id"] and isinstance(schema[k], str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use Validator.ID_OF in some way.

@@ -862,6 +864,40 @@ def resolve_remote(self, uri):
self.store[uri] = result
return result

def store_subschema(self, schema, last_url=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To start I'd not want this to be a public method / addition to the API.

@Julian
Copy link
Member

Julian commented Oct 16, 2020

Awesome! Left 3 quick comments from a first read on the approach. Will have a closer read but let me know if any of those seem unclear.

@WilliamHeaven
Copy link

@willson-chen I think this function is useful. Could you please modify it based on the review comments?

@Julian Julian closed this Oct 20, 2020
@Julian Julian deleted the branch python-jsonschema:master October 20, 2020 16:37
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.

3 participants