Skip to content

Conversation

Julian
Copy link
Member

@Julian Julian commented Jan 20, 2023

This is the first of probably quite a few trivial changes which make our testing of $ref more resillient -- specifically today, we only test very few keywords to ensure subschemas within them are collected / searched for $ids. This work comes out of discussions with Giorgio Ghelli as well as having written an implementation agnostic referencing implementation in a minimal way (i.e. without artificially including keywords even where tests were missing), wherein it was obvious we only have current tests for 5! keywords.

if/then/else are possibly particularly dangerous, since some tools may mistakenly believe that a schema with no if can have then/else dropped, but this is not the case, as the then/else may contain a subschema that will be referenceable elsewhere.

C/o Giorgio Ghelli

@Julian Julian requested a review from a team as a code owner January 20, 2023 17:08
Copy link
Member

@gregsdennis gregsdennis left a comment

Choose a reason for hiding this comment

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

Do we need tests for 2019-09? I don't see them.

I don't know why someone would do this, but the spec says it should be supported. LGTM other that the above question.

@Julian
Copy link
Member Author

Julian commented Jan 20, 2023

Do we need tests for 2019-09? I don't see them.

Indeed! Fixing on merge, thanks (I got sidetracked trying to figure out whether they were needed for draft6, which indeed they're not).

This is the first of probably quite a few trivial changes which
make our testing of $ref more resillient -- specifically today,
we only test very few keywords to ensure subschemas within them
are collected / searched for $ids.

if/then/else are possibly particularly dangerous, since some
tools may mistakenly believe that a schema with no if can have
then/else dropped, but this is not the case, as the then/else
may contain a subschema that will be referenceable elsewhere.

Found via discussion with Giorgio Ghelli.
@Julian Julian merged commit f57d3e0 into main Jan 20, 2023
@Julian Julian deleted the if-then-else-ref branch January 20, 2023 19:13
{
"description": "ref to if",
"schema": {
"$ref": "http://example.com/ref/if",
Copy link
Member

Choose a reason for hiding this comment

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

The $refs for these need to be wrapped in allOf because it's draft-07.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, fixed, e4e1a22 thanks!

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