Skip to content
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

bump JSON Schema test suite #109

Merged
merged 6 commits into from
Dec 8, 2021
Merged

bump JSON Schema test suite #109

merged 6 commits into from
Dec 8, 2021

Conversation

andreineculau
Copy link
Member

@andreineculau andreineculau commented May 26, 2021

as per #107

doing this separately from #108 because there are failing tests in draft3 and draft4 i.e. jesse's current implementation fails some "corner" cases

WORK IN PROGRESS

  • draft3 - additionalProperties
  • draft3 - ref
  • draft4 - additionalItems
  • draft4 - additionalProperties
  • draft4 - enum
  • draft4 - ref
  • draft4 - refRemote

@seriyps
Copy link
Collaborator

seriyps commented Sep 27, 2021

FYI, I'm working on it

* enum check on draft-3 should compare integers and floats just fine
* reset "current schema" in "extends" / "anyOf" / "allOf" etc
@seriyps
Copy link
Collaborator

seriyps commented Sep 27, 2021

Have some difficulties with ref test case "Description: ref overrides any sibling keywords". We are currently crashing when we see that there are other validators siblings to $ref. But it seems that the test is supposed to just ignore all the other keys if there is a $ref defined. I have troubles trying to find a place where this logic can be hooked...

@seriyps
Copy link
Collaborator

seriyps commented Sep 27, 2021

ok, found a workaround for "ref overrides any sibling keywords", but now discovered those "Location-independent identifier". Seems it works similar to # CSS selector (find by ID) and it is mentioned on some of the specifications for some of JSON schema versions https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01#section-8.2.3, but in draft-04 it is mentioned only very little and seems it's even optional: https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-04#section-7.2.4 (json schea specification versioning is very confusing https://json-schema.org/specification-links.html).
So, maybe we should just skip the tests which are testing this feature?

{<<"ref">>, <<"Location-independent identifier">>}
, {<<"ref">>, <<"Recursive references between schemas">>}
, {<<"ref">>, <<"Location-independent identifier with base URI"
" change in subschema">>}
Copy link
Collaborator

Choose a reason for hiding this comment

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

so, 3 test-cases are skipped. Seems all 3 require "arbitrary document-local reference URI lookups" / "location indpendent identifiers", but it seems it would be very difficult to implement them efficiently. Naive way would be to just do recursive descent from #state.root_schema.

@seriyps
Copy link
Collaborator

seriyps commented Sep 27, 2021

@andreineculau I fixed all the tests except 3 I explicitly skipped. I may try to spend some more time on it, but not sure it worth it, because it would be very difficult to implement it efficiently; also I doubt those features are popular...

@seriyps
Copy link
Collaborator

seriyps commented Nov 2, 2021

👋

@seriyps
Copy link
Collaborator

seriyps commented Dec 6, 2021

Let's say that I'll merge it this Wednesday 8th of December, if there will be no objections until then =)

@seriyps seriyps merged commit 6cfd1c0 into master Dec 8, 2021
%% Instead of just removing all the other fields, we put schema as
%% 1st element, so, only `ref' will be validated, while other fields
%% (say, `definitions') may still be referenced.
[{?REF, Ref} | lists:keydelete(?REF, 1, NewSchema0)]
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it crashes when the schema is a map. We caught this today before shipping some code to production... is there a reason not to support map format schemas here? It seems to work elsewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, this was not intentional. I'll make a fix

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @nalundgaard, may you please check that fix from #113 works for you?

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.

None yet

3 participants