diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 2e7f16b815..bd1925ca9c 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -1,6 +1,8 @@ -$id: 'https://spec.openapis.org/oas/3.1/schema/2021-03-02' +$id: 'https://spec.openapis.org/oas/3.1/schema/2022-10-07' $schema: 'https://json-schema.org/draft/2020-12/schema' +description: The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0 + type: object properties: openapi: @@ -9,16 +11,21 @@ properties: info: $ref: '#/$defs/info' jsonSchemaDialect: - $ref: '#/$defs/uri' + type: string + format: uri default: 'https://spec.openapis.org/oas/3.1/dialect/base' servers: - $ref: '#/$defs/server' + type: array + items: + $ref: '#/$defs/server' + default: + - url: / paths: $ref: '#/$defs/paths' webhooks: type: object additionalProperties: - $ref: '#/$defs/path-item-or-reference' + $ref: '#/$defs/path-item' components: $ref: '#/$defs/components' security: @@ -46,6 +53,7 @@ unevaluatedProperties: false $defs: info: + $comment: https://spec.openapis.org/oas/v3.1.0#info-object type: object properties: title: @@ -56,6 +64,7 @@ $defs: type: string termsOfService: type: string + format: uri contact: $ref: '#/$defs/contact' license: @@ -69,18 +78,22 @@ $defs: unevaluatedProperties: false contact: + $comment: https://spec.openapis.org/oas/v3.1.0#contact-object type: object properties: name: type: string url: type: string + format: uri email: type: string + format: email $ref: '#/$defs/specification-extensions' unevaluatedProperties: false license: + $comment: https://spec.openapis.org/oas/v3.1.0#license-object type: object properties: name: @@ -88,22 +101,24 @@ $defs: identifier: type: string url: - $ref: '#/$defs/uri' + type: string + format: uri required: - name - oneOf: - - required: - - identifier - - required: - - url + dependentSchemas: + identifier: + not: + required: + - url $ref: '#/$defs/specification-extensions' unevaluatedProperties: false server: + $comment: https://spec.openapis.org/oas/v3.1.0#server-object type: object properties: url: - $ref: '#/$defs/uri' + type: string description: type: string variables: @@ -116,6 +131,7 @@ $defs: unevaluatedProperties: false server-variable: + $comment: https://spec.openapis.org/oas/v3.1.0#server-variable-object type: object properties: enum: @@ -125,7 +141,7 @@ $defs: minItems: 1 default: type: string - descriptions: + description: type: string required: - default @@ -133,6 +149,7 @@ $defs: unevaluatedProperties: false components: + $comment: https://spec.openapis.org/oas/v3.1.0#components-object type: object properties: schemas: @@ -174,7 +191,7 @@ $defs: pathItems: type: object additionalProperties: - $ref: '#/$defs/path-item-or-reference' + $ref: '#/$defs/path-item' patternProperties: '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$': $comment: Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected @@ -184,6 +201,7 @@ $defs: unevaluatedProperties: false paths: + $comment: https://spec.openapis.org/oas/v3.1.0#paths-object type: object patternProperties: '^/': @@ -192,8 +210,12 @@ $defs: unevaluatedProperties: false path-item: + $comment: https://spec.openapis.org/oas/v3.1.0#path-item-object type: object properties: + $ref: + type: string + format: uri-reference summary: type: string description: @@ -206,22 +228,27 @@ $defs: type: array items: $ref: '#/$defs/parameter-or-reference' - patternProperties: - '^(get|post|delete|options|head|patch|trace)$': + get: + $ref: '#/$defs/operation' + put: + $ref: '#/$defs/operation' + post: + $ref: '#/$defs/operation' + delete: + $ref: '#/$defs/operation' + options: + $ref: '#/$defs/operation' + head: + $ref: '#/$defs/operation' + patch: + $ref: '#/$defs/operation' + trace: $ref: '#/$defs/operation' $ref: '#/$defs/specification-extensions' unevaluatedProperties: false - path-item-or-reference: - if: - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/path-item' - operation: + $comment: https://spec.openapis.org/oas/v3.1.0#operation-object type: object properties: tags: @@ -263,18 +290,21 @@ $defs: unevaluatedProperties: false external-documentation: + $comment: https://spec.openapis.org/oas/v3.1.0#external-documentation-object type: object properties: description: type: string url: - $ref: '#/$defs/uri' + type: string + format: uri required: - url $ref: '#/$defs/specification-extensions' unevaluatedProperties: false parameter: + $comment: https://spec.openapis.org/oas/v3.1.0#parameter-object type: object properties: name: @@ -293,20 +323,31 @@ $defs: deprecated: default: false type: boolean - allowEmptyValue: - default: false - type: boolean schema: $dynamicRef: '#meta' content: $ref: '#/$defs/content' + minProperties: 1 + maxProperties: 1 required: + - name - in oneOf: - required: - schema - required: - content + if: + properties: + in: + const: query + required: + - in + then: + properties: + allowEmptyValue: + default: false + type: boolean dependentSchemas: schema: properties: @@ -314,16 +355,13 @@ $defs: type: string explode: type: boolean - allowReserved: - default: false - type: boolean allOf: - $ref: '#/$defs/examples' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie' - - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form' + - $ref: '#/$defs/styles-for-form' $defs: styles-for-path: @@ -357,8 +395,7 @@ $defs: properties: style: default: simple - enum: - - simple + const: simple styles-for-query: if: @@ -376,6 +413,9 @@ $defs: - spaceDelimited - pipeDelimited - deepObject + allowReserved: + default: false + type: boolean styles-for-cookie: if: @@ -388,30 +428,14 @@ $defs: properties: style: default: form - enum: - - form - - styles-for-form: - if: - properties: - style: const: form - required: - - style - then: - properties: - explode: - default: true - else: - properties: - explode: - default: false $ref: '#/$defs/specification-extensions' unevaluatedProperties: false parameter-or-reference: if: + type: object required: - $ref then: @@ -420,6 +444,7 @@ $defs: $ref: '#/$defs/parameter' request-body: + $comment: https://spec.openapis.org/oas/v3.1.0#request-body-object type: object properties: description: @@ -436,6 +461,7 @@ $defs: request-body-or-reference: if: + type: object required: - $ref then: @@ -444,6 +470,7 @@ $defs: $ref: '#/$defs/request-body' content: + $comment: https://spec.openapis.org/oas/v3.1.0#fixed-fields-10 type: object additionalProperties: $ref: '#/$defs/media-type' @@ -451,6 +478,7 @@ $defs: format: media-range media-type: + $comment: https://spec.openapis.org/oas/v3.1.0#media-type-object type: object properties: schema: @@ -465,6 +493,7 @@ $defs: unevaluatedProperties: false encoding: + $comment: https://spec.openapis.org/oas/v3.1.0#encoding-object type: object properties: contentType: @@ -488,38 +517,30 @@ $defs: type: boolean allOf: - $ref: '#/$defs/specification-extensions' - - $ref: '#/$defs/encoding/$defs/explode-default' + - $ref: '#/$defs/styles-for-form' unevaluatedProperties: false - $defs: - explode-default: - if: - properties: - style: - const: form - required: - - style - then: - properties: - explode: - default: true - else: - properties: - explode: - default: false - responses: + $comment: https://spec.openapis.org/oas/v3.1.0#responses-object type: object properties: default: $ref: '#/$defs/response-or-reference' patternProperties: - '^[1-5][0-9X]{2}$': + '^[1-5](?:[0-9]{2}|XX)$': $ref: '#/$defs/response-or-reference' + minProperties: 1 $ref: '#/$defs/specification-extensions' unevaluatedProperties: false + if: + $comment: either default, or at least one response code property must exist + patternProperties: + '^[1-5](?:[0-9]{2}|XX)$': false + then: + required: [default] response: + $comment: https://spec.openapis.org/oas/v3.1.0#response-object type: object properties: description: @@ -541,6 +562,7 @@ $defs: response-or-reference: if: + type: object required: - $ref then: @@ -549,13 +571,15 @@ $defs: $ref: '#/$defs/response' callbacks: + $comment: https://spec.openapis.org/oas/v3.1.0#callback-object type: object $ref: '#/$defs/specification-extensions' additionalProperties: - $ref: '#/$defs/path-item-or-reference' + $ref: '#/$defs/path-item' callbacks-or-reference: if: + type: object required: - $ref then: @@ -564,6 +588,7 @@ $defs: $ref: '#/$defs/callbacks' example: + $comment: https://spec.openapis.org/oas/v3.1.0#example-object type: object properties: summary: @@ -572,12 +597,18 @@ $defs: type: string value: true externalValue: - $ref: '#/$defs/uri' + type: string + format: uri + not: + required: + - value + - externalValue $ref: '#/$defs/specification-extensions' unevaluatedProperties: false example-or-reference: if: + type: object required: - $ref then: @@ -586,11 +617,14 @@ $defs: $ref: '#/$defs/example' link: + $comment: https://spec.openapis.org/oas/v3.1.0#link-object type: object properties: operationRef: - $ref: '#/$defs/uri' - operationId: true + type: string + format: uri-reference + operationId: + type: string parameters: $ref: '#/$defs/map-of-strings' requestBody: true @@ -608,6 +642,7 @@ $defs: link-or-reference: if: + type: object required: - $ref then: @@ -616,6 +651,7 @@ $defs: $ref: '#/$defs/link' header: + $comment: https://spec.openapis.org/oas/v3.1.0#header-object type: object properties: description: @@ -626,34 +662,33 @@ $defs: deprecated: default: false type: boolean - allowEmptyValue: - default: false - type: boolean + schema: + $dynamicRef: '#meta' + content: + $ref: '#/$defs/content' + minProperties: 1 + maxProperties: 1 + oneOf: + - required: + - schema + - required: + - content dependentSchemas: schema: properties: style: default: simple - enum: - - simple + const: simple explode: default: false type: boolean - allowReserved: - default: false - type: boolean - schema: - $dynamicRef: '#meta' $ref: '#/$defs/examples' - content: - properties: - content: - $ref: '#/$defs/content' $ref: '#/$defs/specification-extensions' unevaluatedProperties: false header-or-reference: if: + type: object required: - $ref then: @@ -662,6 +697,7 @@ $defs: $ref: '#/$defs/header' tag: + $comment: https://spec.openapis.org/oas/v3.1.0#tag-object type: object properties: name: @@ -676,22 +712,26 @@ $defs: unevaluatedProperties: false reference: + $comment: https://spec.openapis.org/oas/v3.1.0#reference-object type: object properties: $ref: - $ref: '#/$defs/uri' + type: string + format: uri-reference summary: type: string description: type: string schema: + $comment: https://spec.openapis.org/oas/v3.1.0#schema-object $dynamicAnchor: meta type: - object - boolean security-scheme: + $comment: https://spec.openapis.org/oas/v3.1.0#security-scheme-object type: object properties: type: @@ -755,7 +795,8 @@ $defs: type: const: http scheme: - const: bearer + type: string + pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$ required: - type - scheme @@ -763,8 +804,6 @@ $defs: properties: bearerFormat: type: string - required: - - scheme type-oauth2: if: @@ -790,12 +829,14 @@ $defs: then: properties: openIdConnectUrl: - $ref: '#/$defs/uri' + type: string + format: uri required: - openIdConnectUrl security-scheme-or-reference: if: + type: object required: - $ref then: @@ -823,8 +864,10 @@ $defs: properties: authorizationUrl: type: string + format: uri refreshUrl: type: string + format: uri scopes: $ref: '#/$defs/map-of-strings' required: @@ -838,8 +881,10 @@ $defs: properties: tokenUrl: type: string + format: uri refreshUrl: type: string + format: uri scopes: $ref: '#/$defs/map-of-strings' required: @@ -853,8 +898,10 @@ $defs: properties: tokenUrl: type: string + format: uri refreshUrl: type: string + format: uri scopes: $ref: '#/$defs/map-of-strings' required: @@ -868,10 +915,13 @@ $defs: properties: authorizationUrl: type: string + format: uri tokenUrl: type: string + format: uri refreshUrl: type: string + format: uri scopes: $ref: '#/$defs/map-of-strings' required: @@ -882,6 +932,7 @@ $defs: unevaluatedProperties: false security-requirement: + $comment: https://spec.openapis.org/oas/v3.1.0#security-requirement-object type: object additionalProperties: type: array @@ -889,6 +940,7 @@ $defs: type: string specification-extensions: + $comment: https://spec.openapis.org/oas/v3.1.0#specification-extensions patternProperties: '^x-': true @@ -900,11 +952,23 @@ $defs: additionalProperties: $ref: '#/$defs/example-or-reference' - uri: - type: string - format: uri - map-of-strings: type: object additionalProperties: type: string + + styles-for-form: + if: + properties: + style: + const: form + required: + - style + then: + properties: + explode: + default: true + else: + properties: + explode: + default: false