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

OAS3 Schema to master #1897

Merged
merged 33 commits into from
Apr 22, 2019
Merged

OAS3 Schema to master #1897

merged 33 commits into from
Apr 22, 2019

Conversation

webron
Copy link
Member

@webron webron commented Apr 18, 2019

Because #1270 was so old it was done against a very old branch 😕

webron and others added 30 commits July 13, 2017 18:05
There is no way to tell a validator that a schema is
using draft-wright-json-schema-validation-00, which is the
only draft with a "uriref" format.  Validators either
interpret schemas as the previous draft (fge-04), which does
not have this concept at all, or the following draft (wright-01)
which has "uri-reference".

Since there are no options that will automatically work correctly,
using the later form seems to be the best.  Many validators allow
registering extensions, and we can just document that we are
using the wright-01+ syntax.  You often need to register format
handlers to get *any* format validation with many validators
anyway, so this does not seem overly burdensome.
Constructs such as:

type: object
not:
  type: object

will always fail, so remove the type inside the not.

The "not" usage around "^x-" patterns for responses is
unnecessary, as the existing

patternProperties:
    "[1-5]..."
additionalProperties: false

prevents all property that do not start with 1, 2, 3, 4, or 5
from being allowed already.
While draft-wright-json-schema-00 forbids JSON References except
where a schema is expected, no validators implement this until
draft-writght-json-schema-01.  wright-00 schemas are in practice
processed as draft-04 schemas, meaning that "$ref" is always
considered a JSON Reference.  Or, at least, some validators do
that.

We can work around this by using a pattern that only matches "$ref".
There is no problem with the $ref in the "required" keyword, as
only "$ref" as a property name is recognized as a reference.
Initial batch of minor schema fixes
Reduce duplications and complexity in v3.0 JSON Schema
Added `id`, `$schema`, `description`
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.

5 participants