Skip to content

Vocabularies and "format" #563

@handrews

Description

@handrews

We have numerous requests for additional formats, or ideas that could be implemented with formats (see #152, #312, json-schema-org/json-schema-vocabularies#45, json-schema-org/json-schema-vocabularies#49, #542).

There have also been a number of discussions around the implementation requirements, particularly

they SHOULD implement validation for [all] attributes defined below

which becomes more burdensome as we add more formats. One idea has been to say that you only need to implement certain subsets (e.g. you could implement the date and time formats but skip the URI/IRI formats, but you shouldn't just implement uri-reference and not uri). But there's no good way to convey support levels. Which brings us to:

Save for agreement between parties, schema authors SHALL NOT expect a peer implementation to support this keyword and/or custom format attributes.

which makes interoperability very challenging. format is really only reliably useful as a semantic annotation, not as validation.

We need a better story here, if for no other reason than to figure out how to manage the endless stream of requests for standardized formats. Currently, that's the only way to achieve any level of interoperability, so there is a high motivation to push for inclusion.


If we go with vocabulary support along the general lines of #561, I feel like this should help manage the variations. A vocabulary could include specific format values (and likewise for contentType and contentEncoding, I suppose).

I've split this out from #561 because it's not clear how it would work. Using a meta-schema, as #561 proposes, doesn't work well for format values because enum is difficult to combine. The typical allOf used to compose vocabularies produces the intersection of enums rather than the union. But anyOf, which would work, would often produce unexpected behaviors otherwise.

Some other mechanism may be required. Therefore this is filed in the future milestone as a question. If we come up with a broadly supported proposal quickly, it can be added to draft-08, but otherwise it's fine as a follow-on in a later draft.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Closed

    Status

    Closed

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions