Skip to content

✨ Proposal: Provide a catalog of reusable types to replace most formats #1607

Open
@jdesrosiers

Description

@jdesrosiers

Describe the inspiration for your proposal

In the discussion about the format registry, someone proposed that formats in the registry include a schema that validates them. Implementations could then use that schema as a fallback if they didn't support the format. It occurred to me that that's just a different kind of referencing system specific to format and if that's the case, why not just use our existing referencing system and save format for things that can't be fully expressed by a schema such as dates. This approach may make the need for additional formats small enough that a registry is not longer necessary.

See #1552 (comment)

Describe the proposal

JSON Schema would maintain and host a catalog of schemas representing standard types that can be used in any schema. This catalog would be only for types that can point to a standard or be otherwise unambiguous. These could replace most of the formats we define in the spec and or the registry. Only those formats that can't be fully expressed with a schema such as dates would remain formats.

This would not be a replacement for SchemaStore.org which is generally used for things like schemas for configuration files. That would be out-of-scope for this catalog. Possibly we could include schemas for Schema.org types because they are standardized, but otherwise I don't expect complex types to be included.

Implementations would have this catalog built-in and/or have a way to pull down the catalog periodically to get recent updates. Retrieving individual schemas from the catalog would be possible but discouraged just like with meta-schemas. In fact, meta-schemas could be included in the catalog as well.

The main drawback of this approach is usability. It's a lot easier for a user to remember and type format: "ipv4" than something like $ref: "https://json-schema.org/catalog/ipv4". Therefore, I'm proposing a custom URI scheme to access the catalog. Something like $ref: "catalog:ipv4".

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalInitial discussion of a new idea. A project will be created once a proposal document is created.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions