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鈥檒l 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

Conversation

Projects
None yet
5 participants
@webron
Copy link
Member

commented Apr 18, 2019

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

webron and others added some commits Jul 14, 2017

Use "uri-reference", not "url" or "uriref"
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.
Fix usage of "not"
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.
Use patternProperties for $ref
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.
Merge pull request #1744 from handrews/schema-fixes
Initial batch of minor schema fixes
Merge pull request #1800 from vearutop/oas3-schema
Reduce duplications and complexity in v3.0 JSON Schema
Add schema metadata
Added `id`, `$schema`, `description`

webron added some commits Apr 18, 2019

@webron webron merged commit 1bb2c28 into master Apr 22, 2019

1 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.