Skip to content

Commit

Permalink
v3.1 Schema fix. $ref should be a uri-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesrosiers committed May 20, 2021
1 parent 1e94f2c commit 5d85f3c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 31 deletions.
4 changes: 2 additions & 2 deletions schemas/v3.1/schema-base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$id": "https://spec.openapis.org/oas/3.1/schema-base/2021-04-15",
"$id": "https://spec.openapis.org/oas/3.1/schema-base/2021-05-20",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "https://spec.openapis.org/oas/3.1/schema/2021-04-15",
"$ref": "https://spec.openapis.org/oas/3.1/schema/2021-05-20",
"properties": {
"jsonSchemaDialect": {
"$ref": "#/$defs/dialect"
Expand Down
4 changes: 2 additions & 2 deletions schemas/v3.1/schema-base.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$id: 'https://spec.openapis.org/oas/3.1/schema-base/2021-04-15'
$id: 'https://spec.openapis.org/oas/3.1/schema-base/2021-05-20'
$schema: 'https://json-schema.org/draft/2020-12/schema'

$ref: 'https://spec.openapis.org/oas/3.1/schema/2021-04-15'
$ref: 'https://spec.openapis.org/oas/3.1/schema/2021-05-20'
properties:
jsonSchemaDialect:
$ref: '#/$defs/dialect'
Expand Down
30 changes: 17 additions & 13 deletions schemas/v3.1/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://spec.openapis.org/oas/3.1/schema/2021-04-15",
"$id": "https://spec.openapis.org/oas/3.1/schema/2021-05-20",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
Expand All @@ -11,7 +11,8 @@
"$ref": "#/$defs/info"
},
"jsonSchemaDialect": {
"$ref": "#/$defs/uri",
"type": "string",
"format": "uri",
"default": "https://spec.openapis.org/oas/3.1/dialect/base"
},
"servers": {
Expand Down Expand Up @@ -130,7 +131,8 @@
"type": "string"
},
"url": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri"
}
},
"required": [
Expand All @@ -155,7 +157,8 @@
"type": "object",
"properties": {
"url": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri-reference"
},
"description": {
"type": "string"
Expand Down Expand Up @@ -390,7 +393,8 @@
"type": "string"
},
"url": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri"
}
},
"required": [
Expand Down Expand Up @@ -849,7 +853,8 @@
},
"value": true,
"externalValue": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri"
}
},
"$ref": "#/$defs/specification-extensions",
Expand All @@ -872,7 +877,8 @@
"type": "object",
"properties": {
"operationRef": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri-reference"
},
"operationId": true,
"parameters": {
Expand Down Expand Up @@ -1003,7 +1009,8 @@
"type": "object",
"properties": {
"$ref": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri-reference"
},
"summary": {
"type": "string"
Expand Down Expand Up @@ -1176,7 +1183,8 @@
"then": {
"properties": {
"openIdConnectUrl": {
"$ref": "#/$defs/uri"
"type": "string",
"format": "uri"
}
},
"required": [
Expand Down Expand Up @@ -1329,10 +1337,6 @@
}
}
},
"uri": {
"type": "string",
"format": "uri"
},
"map-of-strings": {
"type": "object",
"additionalProperties": {
Expand Down
30 changes: 17 additions & 13 deletions schemas/v3.1/schema.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: 'https://spec.openapis.org/oas/3.1/schema/2021-04-15'
$id: 'https://spec.openapis.org/oas/3.1/schema/2021-05-20'
$schema: 'https://json-schema.org/draft/2020-12/schema'

type: object
Expand All @@ -9,7 +9,8 @@ properties:
info:
$ref: '#/$defs/info'
jsonSchemaDialect:
$ref: '#/$defs/uri'
type: string
format: uri
default: 'https://spec.openapis.org/oas/3.1/dialect/base'
servers:
type: array
Expand Down Expand Up @@ -90,7 +91,8 @@ $defs:
identifier:
type: string
url:
$ref: '#/$defs/uri'
type: string
format: uri
required:
- name
oneOf:
Expand All @@ -105,7 +107,8 @@ $defs:
type: object
properties:
url:
$ref: '#/$defs/uri'
type: string
format: uri-reference
description:
type: string
variables:
Expand Down Expand Up @@ -270,7 +273,8 @@ $defs:
description:
type: string
url:
$ref: '#/$defs/uri'
type: string
format: uri
required:
- url
$ref: '#/$defs/specification-extensions'
Expand Down Expand Up @@ -574,7 +578,8 @@ $defs:
type: string
value: true
externalValue:
$ref: '#/$defs/uri'
type: string
format: uri
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false

Expand All @@ -591,7 +596,8 @@ $defs:
type: object
properties:
operationRef:
$ref: '#/$defs/uri'
type: string
format: uri-reference
operationId: true
parameters:
$ref: '#/$defs/map-of-strings'
Expand Down Expand Up @@ -681,7 +687,8 @@ $defs:
type: object
properties:
$ref:
$ref: '#/$defs/uri'
type: string
format: uri-reference
summary:
type: string
description:
Expand Down Expand Up @@ -793,7 +800,8 @@ $defs:
then:
properties:
openIdConnectUrl:
$ref: '#/$defs/uri'
type: string
format: uri
required:
- openIdConnectUrl

Expand Down Expand Up @@ -903,10 +911,6 @@ $defs:
additionalProperties:
$ref: '#/$defs/example-or-reference'

uri:
type: string
format: uri

map-of-strings:
type: object
additionalProperties:
Expand Down
2 changes: 1 addition & 1 deletion tests/v3.1/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before(async () => {
JsonSchema.add(dialect);
JsonSchema.add(vocabulary);
JsonSchema.add(yaml.parse(fs.readFileSync(`${__dirname}/../../schemas/v3.1/schema.yaml`, "utf8"), { prettyErrors: true }));
metaSchema = await JsonSchema.get("https://spec.openapis.org/oas/3.1/schema/2021-03-02");
metaSchema = await JsonSchema.get("https://spec.openapis.org/oas/3.1/schema/2021-05-20");
});

describe("Pass", () => {
Expand Down

0 comments on commit 5d85f3c

Please sign in to comment.