Skip to content

Deprecate URI of meta-schema without version #216

Closed
@epoberezkin

Description

@epoberezkin

Or at the very least prohibit/discourage using it in schemas.

Problem

@handrews wrote in #211 (review):

I did not want to put "additionalProperties": false in with "$ref" because that really is a big change, and some schemas out there (including the draft 4 hyper-schema meta-schema!) would suddenly become invalid.

At first I couldn't understand why would they suddenly become invalid when they have different meta-schema URI. And then I realised that there is a lot of schemas indeed that instead of using URI with version (that I always use) use a generic URI without version (which I never use myself). I only added support for this URI in Ajv after some user submitted PR...

That indeed presents a migration problem as there are many schemas that don't clearly indicate which version of the standard they are using and if, for example, we indeed drop boolean form of exclusiveMaximum without solving this problem, then all the schemas with boolean form of exclusive Maximum/Minimum that use a generic URI for $schema will become invalid.

Suggestion

  1. Stop updating schema at generic URI and have draft 4 schema there. Once draft 6 is published we can add in the description that this schema is deprecated and that instead another URI should be used.
  2. Only use URI with version for meta-schema going forward

Alternatively we can put a big note everywhere saying that schema at /schema uri MUST NOT be used in schemas, that it exists for information only to indicate what is the latest version. Maybe even make it a redirect to the latest version.

But I think it can be better to deprecate it and keep pointing to 4, to be honest...

If we used semver, updates between major versions would not have happened automatically, it would require user action. I don't think meta-schemas should automatically update when the new draft is released.

@handrews @awwright @Relequestual

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions