v3.1 Schema bugfix: Update URI fields to use uri-reference or uri where appropriate
* Fix typo in v3.1 schema tests
* Remove v3.1 schema test for server variable
JSON Schema can't express this constraint
* v3.1 Schema fix. $ref should be a uri-reference
MODIFY
schemas/v3.1/schema-base.json
schemas/v3.1/schema-base.json
{
- "$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"

MODIFY
schemas/v3.1/schema-base.yaml
schemas/v3.1/schema-base.yaml
-$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'

MODIFY
schemas/v3.1/schema.json
schemas/v3.1/schema.json
{
- "$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": {
"$ref": "#/$defs/info"
},
"jsonSchemaDialect": {
- "$ref": "#/$defs/uri",
+ "type": "string",
+ "format": "uri",
"default": "https://spec.openapis.org/oas/3.1/dialect/base"
},
"servers": {
"type": "string"
},
"url": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri"
}
},
"required": [
"type": "object",
"properties": {
"url": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri-reference"
},
"description": {
"type": "string"
"type": "string"
},
"url": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri"
}
},
"required": [
},
"value": true,
"externalValue": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri"
}
},
"$ref": "#/$defs/specification-extensions",
"type": "object",
"properties": {
"operationRef": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri-reference"
},
"operationId": true,
"parameters": {
"type": "object",
"properties": {
"$ref": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri-reference"
},
"summary": {
"type": "string"
"then": {
"properties": {
"openIdConnectUrl": {
- "$ref": "#/$defs/uri"
+ "type": "string",
+ "format": "uri"
}
},
"required": [
}
}
},
- "uri": {
- "type": "string",
- "format": "uri"
- },
"map-of-strings": {
"type": "object",
"additionalProperties": {

MODIFY
schemas/v3.1/schema.yaml
schemas/v3.1/schema.yaml
-$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
@@ -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
@@ -90,7 +91,8 @@ $defs:
identifier:
type: string
url:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri
required:
- name
oneOf:
@@ -105,7 +107,8 @@ $defs:
type: object
properties:
url:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri-reference
description:
type: string
variables:
@@ -270,7 +273,8 @@ $defs:
description:
type: string
url:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri
required:
- url
$ref: '#/$defs/specification-extensions'
@@ -574,7 +578,8 @@ $defs:
type: string
value: true
externalValue:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
@@ -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'
@@ -681,7 +687,8 @@ $defs:
type: object
properties:
$ref:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri-reference
summary:
type: string
description:
@@ -793,7 +800,8 @@ $defs:
then:
properties:
openIdConnectUrl:
- $ref: '#/$defs/uri'
+ type: string
+ format: uri
required:
- openIdConnectUrl
@@ -903,10 +911,6 @@ $defs:
additionalProperties:
$ref: '#/$defs/example-or-reference'
- uri:
- type: string
- format: uri
-
map-of-strings:
type: object
additionalProperties:

RENAME
tests/v3.1/fail/sever_enum_empty.yaml
tests/v3.1/fail/server_enum_empty.yaml
DELETE
tests/v3.1/fail/sever_enum_unknown.yaml
-openapi: 3.1.0
-info:
- title: API
- version: 1.0.0
-servers:
- - url: https://example.com/{var}
- variables:
- var:
- enum:
- - a
- default: b
-components: {}

MODIFY
tests/v3.1/test.js
tests/v3.1/test.js
@@ -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", () => {

v3.1 Schema bugfix: Update URI fields to use uri-reference or uri where appropriate (#2586)

* Fix typo in v3.1 schema tests

* Remove v3.1 schema test for server variable

JSON Schema can't express this constraint

* v3.1 Schema fix. $ref should be a uri-reference