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

Revert "by default, "format" only annotates, not validates" #515

Merged
merged 1 commit into from
Sep 11, 2021

Conversation

karenetheridge
Copy link
Member

This reverts commit 043dc63
(and also removes the tests from draft-future, which were copied from
draft2020-12).

According to the spec, "$vocabulary": { "...format-assertion": false }
does not mean "do not assert formats", but rather "if you don't support
format-assertion, you can still load the schema. but if you do support it,
feel free to assert that behaviour if you wish".

ref. https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.2

As such, the data in the removed tests could result in either a true OR a
false result. If we wish to explicitly test "formats are only annotations, and
NOT assertions" behaviour, we will have to define a custom metaschema and
reference that with the $schema keyword, where the metaschema contains:

"$vocabulary": {
    ...
    "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
}

and does NOT mention the format-assertion vocabulary whatsoever.

This would be a reasonable test of the $vocabulary keyword, too.

This reverts commit 043dc63
(and also removes the tests from draft-future, which were copied from
draft2020-12).

According to the spec, "$vocabulary": { "...format-assertion": false }
does not mean "do not assert formats", but rather "if you don't support
format-assertion, you can still load the schema. but if you do support it,
feel free to assert that behaviour if you wish".

ref. https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.2

As such, the data in the removed tests could result in either a true OR a
false result. If we wish to explicitly test "formats are only annotations, and
NOT assertions" behaviour, we will have to define a custom metaschema and
reference that with the $schema keyword, where the metaschema contains:

    "$vocabulary": {
        ...
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
    }

and does NOT mention the format-assertion vocabulary whatsoever.

This would be a reasonable test of the $vocabulary keyword, too.
@karenetheridge karenetheridge requested review from Julian and a team September 10, 2021 22:16
@Julian
Copy link
Member

Julian commented Sep 11, 2021

Thank you for working this out! lgtm

@Julian Julian merged commit 72e31dd into master Sep 11, 2021
@Julian Julian deleted the ether/fix-mandatory-format-tests branch September 11, 2021 13:13
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.

2 participants