Skip to content

Incorrect Revert "by default, "format" only annotates, not validates"? #660

@Relequestual

Description

@Relequestual

PR #515 reverted/removed some tests. I believe this was in error and should not have been merged.

In the PR, @karenetheridge argues...

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".

That's correct. They continue...

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.

When we inspect the 2020-12 meta-schema, and the 2019-09 meta-schema, we actually find the following $vocabulary declarations...

    "$vocabulary": {
        "https://json-schema.org/draft/2020-12/vocab/core": true,
        "https://json-schema.org/draft/2020-12/vocab/applicator": true,
        "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
        "https://json-schema.org/draft/2020-12/vocab/validation": true,
        "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
        "https://json-schema.org/draft/2020-12/vocab/content": true
    },

https://github.com/json-schema-org/json-schema-spec/blob/769daad75a9553562333a8937a187741cb708c72/schema.json#L4-L12

Git histroy shows that the line format-annotation: true was comitted 2020-11-24, while PR #515 was opened 2021-09-10.

(I note that the linked commit was done outside of a PR and comitted directly, by me. Bad previous me. However, I did find the justification: json-schema-org/json-schema-spec#1027 (comment), so I wasn't totally rogue.)

Based on these facts, I think that PR needs to be reverted, and the tests should be included.

I found this issue when looking for these tests and not finding them.

(This Issue may be related, but I'm not 100% sure: #495)

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueAn issue that is a good candidate for new contributorsmissing testA request to add a test to the suite that is currently not covered elsewhere.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions