From 7dfe74325e89182d47c98e325541df5d3b1cd7fe Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 15:01:07 +0200 Subject: [PATCH 1/8] Delete src/schemas/validation directory --- src/schemas/validation/README.md | 69 -- src/schemas/validation/dialect.yaml | 21 - src/schemas/validation/meta.yaml | 70 -- src/schemas/validation/schema-base.yaml | 20 - src/schemas/validation/schema.yaml | 974 ------------------------ 5 files changed, 1154 deletions(-) delete mode 100644 src/schemas/validation/README.md delete mode 100644 src/schemas/validation/dialect.yaml delete mode 100644 src/schemas/validation/meta.yaml delete mode 100644 src/schemas/validation/schema-base.yaml delete mode 100644 src/schemas/validation/schema.yaml diff --git a/src/schemas/validation/README.md b/src/schemas/validation/README.md deleted file mode 100644 index 57501dfc51..0000000000 --- a/src/schemas/validation/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# OpenAPI 3.X.Y JSON Schema - -This directory contains the YAML sources for generating the JSON Schemas for validating OpenAPI definitions of versions 3.X.Y, which are published on [https://spec.openapis.org](https://spec.openapis.org). - -Due to limitations of GitHub pages, the schemas on the spec site are served with `Content-Type: application/octet-stream`, but should be interpreted as `application/schema+json`. - -The sources in this directory, which have `WORK-IN-PROGRESS` in their `$id`s, are _not intended for direct use_. - -## Schema `$id` dates - -The published schemas on the spec site have an _iteration date_ in their `id`s. -This allows the schemas for a release line to be updated independent of the spec patch release cycle. - -The iteration version of the JSON Schema can be found in the `$id` field. -For example, the value of `$id: https://spec.openapis.org/oas/3.1/schema/2021-03-02` means this iteration was created on March 2nd, 2021. - -We are [working on](https://github.com/OAI/OpenAPI-Specification/issues/4152) how to best provide programmatic access for determining the latest date for each schema. - -## Choosing which schema to use - -There are two schemas to choose from for versions 3.1 and greater, both of which have an `$id` that starts with `https://spec.openapis.org/oas/3.X/` and ends with the iteration date: - -* `https://spec.openapis.org/oas/3.X/schema/{date}`, source: `schema.yaml` — A self-contained schema that _does not_ validate Schema Objects beyond `type: [object, boolean]` -* `https://spec.openapis.org/oas/3.1/schema-base/{date}`, source: `schema-base.yaml` — A schema that combines the self-contained schema and the "base" dialect schema to validate Schema Objects with the dialect; this schema does not allow changing `$schema` or `jsonSchemaDialect` to other dialects - -Two metaschemas define the OAS "base" dialect: - -* `https://spec.openapis.org/oas/3.X/meta/{date}`, source: `meta.yaml` — The vocabulary metaschema for OAS 3.X's extensions to draft 2020-12 -* `https://spec.openapis.org/oas/3.X/dialect/{date}`, source: `dialect.yaml` — The dialect metaschema that extends the standard `draft/2020-12` metaschema by adding the OAS "base" vocabulary - -The name "base" for the dialect was intended to indicate that the OAS dialect could be further extended. - -~~~mermaid -flowchart LR - schema_base - schema - dialect - meta - schema --> |default| dialect - schema_base --> |$ref| schema - schema_base --> |$ref| dialect - dialect --> |$ref| meta -~~~ - -An additional schema that validates the Schema Object with the OAS 3.X dialect but does not restrict changing `$schema` is [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4147). - -## Improving the schemas - -As a reminder, the JSON Schema is not the source of truth for the Specification. In cases of conflicts between the Specification itself and the JSON Schema, the Specification wins. Also, some Specification constraints cannot be represented with the JSON Schema so it's highly recommended to employ other methods to ensure compliance. - -The schema only validates the mandatory aspects of the OAS. -Validating requirements that are optional, or field usage that has undefined or ignored behavior are not within the scope of this schema. -Schemas to perform additional optional validation are [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4141). - -Improvements can be submitted by opening a PR against the `vX.Y-dev` branch of the respective specification version. - -Modify the `schema.yaml` file and add test cases for your changes. - -The TSC will then: -- Run tests on the updated schema -- Update the iteration version -- Publish the new version - -The [test suite](../../../tests/schema) is part of this package. - -```bash -npm install -npm test -``` diff --git a/src/schemas/validation/dialect.yaml b/src/schemas/validation/dialect.yaml deleted file mode 100644 index d300d94feb..0000000000 --- a/src/schemas/validation/dialect.yaml +++ /dev/null @@ -1,21 +0,0 @@ -$id: https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS -$schema: https://json-schema.org/draft/2020-12/schema - -title: OpenAPI 3.1 Schema Object Dialect -description: A JSON Schema dialect describing schemas found in OpenAPI v3.1 Descriptions - -$dynamicAnchor: meta - -$vocabulary: - https://json-schema.org/draft/2020-12/vocab/applicator: true - https://json-schema.org/draft/2020-12/vocab/content: true - https://json-schema.org/draft/2020-12/vocab/core: true - https://json-schema.org/draft/2020-12/vocab/format-annotation: true - https://json-schema.org/draft/2020-12/vocab/meta-data: true - https://json-schema.org/draft/2020-12/vocab/unevaluated: true - https://json-schema.org/draft/2020-12/vocab/validation: true - https://spec.openapis.org/oas/3.1/vocab/base: false - -allOf: - - $ref: https://json-schema.org/draft/2020-12/schema - - $ref: https://spec.openapis.org/oas/3.1/meta/WORK-IN-PROGRESS diff --git a/src/schemas/validation/meta.yaml b/src/schemas/validation/meta.yaml deleted file mode 100644 index 6cfce4976d..0000000000 --- a/src/schemas/validation/meta.yaml +++ /dev/null @@ -1,70 +0,0 @@ -$id: https://spec.openapis.org/oas/3.1/meta/WORK-IN-PROGRESS -$schema: https://json-schema.org/draft/2020-12/schema - -title: OAS Base Vocabulary -description: A JSON Schema Vocabulary used in the OpenAPI Schema Dialect - -$dynamicAnchor: meta - -$vocabulary: - https://spec.openapis.org/oas/3.1/vocab/base: true - -type: - - object - - boolean -properties: - discriminator: - $ref: '#/$defs/discriminator' - example: true - externalDocs: - $ref: '#/$defs/external-docs' - xml: - $ref: '#/$defs/xml' - -$defs: - discriminator: - $ref: '#/$defs/extensible' - properties: - mapping: - additionalProperties: - type: string - type: object - propertyName: - type: string - required: - - propertyName - type: object - unevaluatedProperties: false - - extensible: - patternProperties: - ^x-: true - external-docs: - $ref: '#/$defs/extensible' - properties: - description: - type: string - url: - format: uri-reference - type: string - required: - - url - type: object - unevaluatedProperties: false - - xml: - $ref: '#/$defs/extensible' - properties: - attribute: - type: boolean - name: - type: string - namespace: - format: uri - type: string - prefix: - type: string - wrapped: - type: boolean - type: object - unevaluatedProperties: false diff --git a/src/schemas/validation/schema-base.yaml b/src/schemas/validation/schema-base.yaml deleted file mode 100644 index ea239c03e9..0000000000 --- a/src/schemas/validation/schema-base.yaml +++ /dev/null @@ -1,20 +0,0 @@ -$id: 'https://spec.openapis.org/oas/3.1/schema-base/WORK-IN-PROGRESS' -$schema: 'https://json-schema.org/draft/2020-12/schema' - -description: The description of OpenAPI v3.1.x Documents using the OpenAPI JSON Schema dialect - -$ref: 'https://spec.openapis.org/oas/3.1/schema/WORK-IN-PROGRESS' -properties: - jsonSchemaDialect: - $ref: '#/$defs/dialect' - -$defs: - dialect: - const: 'https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS' - - schema: - $dynamicAnchor: meta - $ref: 'https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS' - properties: - $schema: - $ref: '#/$defs/dialect' diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml deleted file mode 100644 index 54c49a2f97..0000000000 --- a/src/schemas/validation/schema.yaml +++ /dev/null @@ -1,974 +0,0 @@ -$id: 'https://spec.openapis.org/oas/3.1/schema/WORK-IN-PROGRESS' -$schema: 'https://json-schema.org/draft/2020-12/schema' - -description: The description of OpenAPI v3.1.x Documents without Schema Object validation - -type: object -properties: - openapi: - type: string - pattern: '^3\.1\.\d+(-.+)?$' - info: - $ref: '#/$defs/info' - jsonSchemaDialect: - type: string - format: uri - default: 'https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS' - servers: - type: array - items: - $ref: '#/$defs/server' - default: - - url: / - paths: - $ref: '#/$defs/paths' - webhooks: - type: object - additionalProperties: - $ref: '#/$defs/path-item' - components: - $ref: '#/$defs/components' - security: - type: array - items: - $ref: '#/$defs/security-requirement' - tags: - type: array - items: - $ref: '#/$defs/tag' - externalDocs: - $ref: '#/$defs/external-documentation' -required: - - openapi - - info -anyOf: - - required: - - paths - - required: - - components - - required: - - webhooks -$ref: '#/$defs/specification-extensions' -unevaluatedProperties: false - -$defs: - info: - $comment: https://spec.openapis.org/oas/v3.1#info-object - type: object - properties: - title: - type: string - summary: - type: string - description: - type: string - termsOfService: - type: string - format: uri - contact: - $ref: '#/$defs/contact' - license: - $ref: '#/$defs/license' - version: - type: string - required: - - title - - version - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - contact: - $comment: https://spec.openapis.org/oas/v3.1#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#license-object - type: object - properties: - name: - type: string - identifier: - type: string - url: - type: string - format: uri - required: - - name - dependentSchemas: - identifier: - not: - required: - - url - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - server: - $comment: https://spec.openapis.org/oas/v3.1#server-object - type: object - properties: - url: - type: string - description: - type: string - variables: - type: object - additionalProperties: - $ref: '#/$defs/server-variable' - required: - - url - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - server-variable: - $comment: https://spec.openapis.org/oas/v3.1#server-variable-object - type: object - properties: - enum: - type: array - items: - type: string - minItems: 1 - default: - type: string - description: - type: string - required: - - default - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - components: - $comment: https://spec.openapis.org/oas/v3.1#components-object - type: object - properties: - schemas: - type: object - additionalProperties: - $dynamicRef: '#meta' - responses: - type: object - additionalProperties: - $ref: '#/$defs/response-or-reference' - parameters: - type: object - additionalProperties: - $ref: '#/$defs/parameter-or-reference' - examples: - type: object - additionalProperties: - $ref: '#/$defs/example-or-reference' - requestBodies: - type: object - additionalProperties: - $ref: '#/$defs/request-body-or-reference' - headers: - type: object - additionalProperties: - $ref: '#/$defs/header-or-reference' - securitySchemes: - type: object - additionalProperties: - $ref: '#/$defs/security-scheme-or-reference' - links: - type: object - additionalProperties: - $ref: '#/$defs/link-or-reference' - callbacks: - type: object - additionalProperties: - $ref: '#/$defs/callbacks-or-reference' - pathItems: - type: object - additionalProperties: - $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 - propertyNames: - pattern: '^[a-zA-Z0-9._-]+$' - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - paths: - $comment: https://spec.openapis.org/oas/v3.1#paths-object - type: object - patternProperties: - '^/': - $ref: '#/$defs/path-item' - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - path-item: - $comment: https://spec.openapis.org/oas/v3.1#path-item-object - type: object - properties: - $ref: - type: string - format: uri-reference - summary: - type: string - description: - type: string - servers: - type: array - items: - $ref: '#/$defs/server' - parameters: - type: array - items: - $ref: '#/$defs/parameter-or-reference' - 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 - - operation: - $comment: https://spec.openapis.org/oas/v3.1#operation-object - type: object - properties: - tags: - type: array - items: - type: string - summary: - type: string - description: - type: string - externalDocs: - $ref: '#/$defs/external-documentation' - operationId: - type: string - parameters: - type: array - items: - $ref: '#/$defs/parameter-or-reference' - requestBody: - $ref: '#/$defs/request-body-or-reference' - responses: - $ref: '#/$defs/responses' - callbacks: - type: object - additionalProperties: - $ref: '#/$defs/callbacks-or-reference' - deprecated: - default: false - type: boolean - security: - type: array - items: - $ref: '#/$defs/security-requirement' - servers: - type: array - items: - $ref: '#/$defs/server' - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - external-documentation: - $comment: https://spec.openapis.org/oas/v3.1#external-documentation-object - type: object - properties: - description: - type: string - url: - type: string - format: uri - required: - - url - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - parameter: - $comment: https://spec.openapis.org/oas/v3.1#parameter-object - type: object - properties: - name: - type: string - in: - enum: - - query - - header - - path - - cookie - description: - type: string - required: - default: false - type: boolean - deprecated: - 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: - style: - type: string - explode: - 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/styles-for-form' - - $defs: - styles-for-path: - if: - properties: - in: - const: path - required: - - in - then: - properties: - style: - default: simple - enum: - - matrix - - label - - simple - required: - const: true - required: - - required - - styles-for-header: - if: - properties: - in: - const: header - required: - - in - then: - properties: - style: - default: simple - const: simple - - styles-for-query: - if: - properties: - in: - const: query - required: - - in - then: - properties: - style: - default: form - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - allowReserved: - default: false - type: boolean - - styles-for-cookie: - if: - properties: - in: - const: cookie - required: - - in - then: - properties: - style: - default: form - const: form - - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - parameter-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/parameter' - - request-body: - $comment: https://spec.openapis.org/oas/v3.1#request-body-object - type: object - properties: - description: - type: string - content: - $ref: '#/$defs/content' - required: - default: false - type: boolean - required: - - content - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - request-body-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/request-body' - - content: - $comment: https://spec.openapis.org/oas/v3.1#fixed-fields-10 - type: object - additionalProperties: - $ref: '#/$defs/media-type' - propertyNames: - format: media-range - - media-type: - $comment: https://spec.openapis.org/oas/v3.1#media-type-object - type: object - properties: - schema: - $dynamicRef: '#meta' - encoding: - type: object - additionalProperties: - $ref: '#/$defs/encoding' - allOf: - - $ref: '#/$defs/specification-extensions' - - $ref: '#/$defs/examples' - unevaluatedProperties: false - - encoding: - $comment: https://spec.openapis.org/oas/v3.1#encoding-object - type: object - properties: - contentType: - type: string - format: media-range - headers: - type: object - additionalProperties: - $ref: '#/$defs/header-or-reference' - style: - default: form - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - explode: - type: boolean - allowReserved: - default: false - type: boolean - allOf: - - $ref: '#/$defs/specification-extensions' - - $ref: '#/$defs/styles-for-form' - unevaluatedProperties: false - - responses: - $comment: https://spec.openapis.org/oas/v3.1#responses-object - type: object - properties: - default: - $ref: '#/$defs/response-or-reference' - patternProperties: - '^[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#response-object - type: object - properties: - description: - type: string - headers: - type: object - additionalProperties: - $ref: '#/$defs/header-or-reference' - content: - $ref: '#/$defs/content' - links: - type: object - additionalProperties: - $ref: '#/$defs/link-or-reference' - required: - - description - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - response-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/response' - - callbacks: - $comment: https://spec.openapis.org/oas/v3.1#callback-object - type: object - $ref: '#/$defs/specification-extensions' - additionalProperties: - $ref: '#/$defs/path-item' - - callbacks-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/callbacks' - - example: - $comment: https://spec.openapis.org/oas/v3.1#example-object - type: object - properties: - summary: - type: string - description: - type: string - value: true - externalValue: - type: string - format: uri - not: - required: - - value - - externalValue - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - example-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/example' - - link: - $comment: https://spec.openapis.org/oas/v3.1#link-object - type: object - properties: - operationRef: - type: string - format: uri-reference - operationId: - type: string - parameters: - $ref: '#/$defs/map-of-strings' - requestBody: true - description: - type: string - body: - $ref: '#/$defs/server' - oneOf: - - required: - - operationRef - - required: - - operationId - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - link-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/link' - - header: - $comment: https://spec.openapis.org/oas/v3.1#header-object - type: object - properties: - description: - type: string - required: - default: false - type: boolean - deprecated: - 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 - const: simple - explode: - default: false - type: boolean - $ref: '#/$defs/examples' - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - header-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/header' - - tag: - $comment: https://spec.openapis.org/oas/v3.1#tag-object - type: object - properties: - name: - type: string - description: - type: string - externalDocs: - $ref: '#/$defs/external-documentation' - required: - - name - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - reference: - $comment: https://spec.openapis.org/oas/v3.1#reference-object - type: object - properties: - $ref: - type: string - format: uri-reference - summary: - type: string - description: - type: string - - schema: - $comment: https://spec.openapis.org/oas/v3.1#schema-object - $dynamicAnchor: meta - type: - - object - - boolean - - security-scheme: - $comment: https://spec.openapis.org/oas/v3.1#security-scheme-object - type: object - properties: - type: - enum: - - apiKey - - http - - mutualTLS - - oauth2 - - openIdConnect - description: - type: string - required: - - type - allOf: - - $ref: '#/$defs/specification-extensions' - - $ref: '#/$defs/security-scheme/$defs/type-apikey' - - $ref: '#/$defs/security-scheme/$defs/type-http' - - $ref: '#/$defs/security-scheme/$defs/type-http-bearer' - - $ref: '#/$defs/security-scheme/$defs/type-oauth2' - - $ref: '#/$defs/security-scheme/$defs/type-oidc' - unevaluatedProperties: false - - $defs: - type-apikey: - if: - properties: - type: - const: apiKey - required: - - type - then: - properties: - name: - type: string - in: - enum: - - query - - header - - cookie - required: - - name - - in - - type-http: - if: - properties: - type: - const: http - required: - - type - then: - properties: - scheme: - type: string - required: - - scheme - - type-http-bearer: - if: - properties: - type: - const: http - scheme: - type: string - pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$ - required: - - type - - scheme - then: - properties: - bearerFormat: - type: string - - type-oauth2: - if: - properties: - type: - const: oauth2 - required: - - type - then: - properties: - flows: - $ref: '#/$defs/oauth-flows' - required: - - flows - - type-oidc: - if: - properties: - type: - const: openIdConnect - required: - - type - then: - properties: - openIdConnectUrl: - type: string - format: uri - required: - - openIdConnectUrl - - security-scheme-or-reference: - if: - type: object - required: - - $ref - then: - $ref: '#/$defs/reference' - else: - $ref: '#/$defs/security-scheme' - - oauth-flows: - type: object - properties: - implicit: - $ref: '#/$defs/oauth-flows/$defs/implicit' - password: - $ref: '#/$defs/oauth-flows/$defs/password' - clientCredentials: - $ref: '#/$defs/oauth-flows/$defs/client-credentials' - authorizationCode: - $ref: '#/$defs/oauth-flows/$defs/authorization-code' - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - $defs: - implicit: - type: object - properties: - authorizationUrl: - type: string - format: uri - refreshUrl: - type: string - format: uri - scopes: - $ref: '#/$defs/map-of-strings' - required: - - authorizationUrl - - scopes - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - password: - type: object - properties: - tokenUrl: - type: string - format: uri - refreshUrl: - type: string - format: uri - scopes: - $ref: '#/$defs/map-of-strings' - required: - - tokenUrl - - scopes - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - client-credentials: - type: object - properties: - tokenUrl: - type: string - format: uri - refreshUrl: - type: string - format: uri - scopes: - $ref: '#/$defs/map-of-strings' - required: - - tokenUrl - - scopes - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - authorization-code: - type: object - properties: - authorizationUrl: - type: string - format: uri - tokenUrl: - type: string - format: uri - refreshUrl: - type: string - format: uri - scopes: - $ref: '#/$defs/map-of-strings' - required: - - authorizationUrl - - tokenUrl - - scopes - $ref: '#/$defs/specification-extensions' - unevaluatedProperties: false - - security-requirement: - $comment: https://spec.openapis.org/oas/v3.1#security-requirement-object - type: object - additionalProperties: - type: array - items: - type: string - - specification-extensions: - $comment: https://spec.openapis.org/oas/v3.1#specification-extensions - patternProperties: - '^x-': true - - examples: - properties: - example: true - examples: - type: object - additionalProperties: - $ref: '#/$defs/example-or-reference' - - 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 From 8ff7efebe577d4a3ea38b057ac61d8d63fa46d31 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:20:39 +0200 Subject: [PATCH 2/8] Migrate schema.yaml to validation directory --- {_archive_/schemas/v3.0 => src/schemas/validation}/schema.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {_archive_/schemas/v3.0 => src/schemas/validation}/schema.yaml (100%) diff --git a/_archive_/schemas/v3.0/schema.yaml b/src/schemas/validation/schema.yaml similarity index 100% rename from _archive_/schemas/v3.0/schema.yaml rename to src/schemas/validation/schema.yaml From 2d497d66c3b2879b36d258e593720a767f341ef8 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:24:05 +0200 Subject: [PATCH 3/8] Move README.md to validation schemas directory --- {_archive_/schemas/v3.0 => src/schemas/validation}/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {_archive_/schemas/v3.0 => src/schemas/validation}/README.md (100%) diff --git a/_archive_/schemas/v3.0/README.md b/src/schemas/validation/README.md similarity index 100% rename from _archive_/schemas/v3.0/README.md rename to src/schemas/validation/README.md From 1ea9c3ae6dd7487af06034d1db34090ff2576c09 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:56:29 +0200 Subject: [PATCH 4/8] Delete tests/schema/pass directory --- tests/schema/pass/comp_pathitems.yaml | 6 -- tests/schema/pass/info_summary.yaml | 6 -- tests/schema/pass/json_schema_dialect.yaml | 15 ----- tests/schema/pass/license_identifier.yaml | 9 --- tests/schema/pass/mega.yaml | 48 ---------------- tests/schema/pass/minimal_comp.yaml | 5 -- tests/schema/pass/minimal_hooks.yaml | 5 -- tests/schema/pass/minimal_paths.yaml | 5 -- tests/schema/pass/non-oauth-scopes.yaml | 19 ------- tests/schema/pass/path_no_response.yaml | 7 --- .../schema/pass/path_var_empty_pathitem.yaml | 6 -- tests/schema/pass/schema.yaml | 55 ------------------- tests/schema/pass/servers.yaml | 10 ---- tests/schema/pass/valid_schema_types.yaml | 14 ----- tests/schema/pass/webhook-example.yaml | 35 ------------ 15 files changed, 245 deletions(-) delete mode 100644 tests/schema/pass/comp_pathitems.yaml delete mode 100644 tests/schema/pass/info_summary.yaml delete mode 100644 tests/schema/pass/json_schema_dialect.yaml delete mode 100644 tests/schema/pass/license_identifier.yaml delete mode 100644 tests/schema/pass/mega.yaml delete mode 100644 tests/schema/pass/minimal_comp.yaml delete mode 100644 tests/schema/pass/minimal_hooks.yaml delete mode 100644 tests/schema/pass/minimal_paths.yaml delete mode 100644 tests/schema/pass/non-oauth-scopes.yaml delete mode 100644 tests/schema/pass/path_no_response.yaml delete mode 100644 tests/schema/pass/path_var_empty_pathitem.yaml delete mode 100644 tests/schema/pass/schema.yaml delete mode 100644 tests/schema/pass/servers.yaml delete mode 100644 tests/schema/pass/valid_schema_types.yaml delete mode 100644 tests/schema/pass/webhook-example.yaml diff --git a/tests/schema/pass/comp_pathitems.yaml b/tests/schema/pass/comp_pathitems.yaml deleted file mode 100644 index 502ca1fca2..0000000000 --- a/tests/schema/pass/comp_pathitems.yaml +++ /dev/null @@ -1,6 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -components: - pathItems: {} diff --git a/tests/schema/pass/info_summary.yaml b/tests/schema/pass/info_summary.yaml deleted file mode 100644 index 30d224afc2..0000000000 --- a/tests/schema/pass/info_summary.yaml +++ /dev/null @@ -1,6 +0,0 @@ -openapi: 3.1.0 -info: - title: API - summary: My lovely API - version: 1.0.0 -components: {} diff --git a/tests/schema/pass/json_schema_dialect.yaml b/tests/schema/pass/json_schema_dialect.yaml deleted file mode 100644 index ae0ed863b3..0000000000 --- a/tests/schema/pass/json_schema_dialect.yaml +++ /dev/null @@ -1,15 +0,0 @@ -openapi: 3.1.0 -info: - summary: Testing jsonSchemaDialect - title: My API - version: 1.0.0 - license: - name: Apache 2.0 - identifier: Apache-2.0 -jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS -components: - schemas: - WithDollarSchema: - $id: "locked-metaschema" - $schema: https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS -paths: {} diff --git a/tests/schema/pass/license_identifier.yaml b/tests/schema/pass/license_identifier.yaml deleted file mode 100644 index fbdba5efbe..0000000000 --- a/tests/schema/pass/license_identifier.yaml +++ /dev/null @@ -1,9 +0,0 @@ -openapi: 3.1.0 -info: - title: API - summary: My lovely API - version: 1.0.0 - license: - name: Apache - identifier: Apache-2.0 -components: {} diff --git a/tests/schema/pass/mega.yaml b/tests/schema/pass/mega.yaml deleted file mode 100644 index 98ce577dce..0000000000 --- a/tests/schema/pass/mega.yaml +++ /dev/null @@ -1,48 +0,0 @@ -openapi: 3.1.0 -info: - summary: My API's summary - title: My API - version: 1.0.0 - license: - name: Apache 2.0 - identifier: Apache-2.0 -paths: - /: - get: - parameters: [] - /{pathTest}: {} -webhooks: - myWebhook: - $ref: '#/components/pathItems/myPathItem' - description: Overriding description -components: - securitySchemes: - mtls: - type: mutualTLS - pathItems: - myPathItem: - post: - requestBody: - required: true - content: - 'application/json': - schema: - type: object - properties: - type: - type: string - int: - type: integer - exclusiveMaximum: 100 - exclusiveMinimum: 0 - none: - type: 'null' - arr: - type: array - $comment: Array without items keyword - either: - type: ['string','null'] - discriminator: - propertyName: type - x-extension: true - myArbitraryKeyword: true diff --git a/tests/schema/pass/minimal_comp.yaml b/tests/schema/pass/minimal_comp.yaml deleted file mode 100644 index 4553689ab4..0000000000 --- a/tests/schema/pass/minimal_comp.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -components: {} diff --git a/tests/schema/pass/minimal_hooks.yaml b/tests/schema/pass/minimal_hooks.yaml deleted file mode 100644 index e67b2889de..0000000000 --- a/tests/schema/pass/minimal_hooks.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -webhooks: {} diff --git a/tests/schema/pass/minimal_paths.yaml b/tests/schema/pass/minimal_paths.yaml deleted file mode 100644 index 016e86796f..0000000000 --- a/tests/schema/pass/minimal_paths.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -paths: {} diff --git a/tests/schema/pass/non-oauth-scopes.yaml b/tests/schema/pass/non-oauth-scopes.yaml deleted file mode 100644 index e757452f38..0000000000 --- a/tests/schema/pass/non-oauth-scopes.yaml +++ /dev/null @@ -1,19 +0,0 @@ -openapi: 3.1.0 -info: - title: Non-oAuth Scopes example - version: 1.0.0 -paths: - /users: - get: - security: - - bearerAuth: - - 'read:users' - - 'public' -components: - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: jwt - description: 'note: non-oauth scopes are not defined at the securityScheme level' - diff --git a/tests/schema/pass/path_no_response.yaml b/tests/schema/pass/path_no_response.yaml deleted file mode 100644 index 334608f111..0000000000 --- a/tests/schema/pass/path_no_response.yaml +++ /dev/null @@ -1,7 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -paths: - /: - get: {} diff --git a/tests/schema/pass/path_var_empty_pathitem.yaml b/tests/schema/pass/path_var_empty_pathitem.yaml deleted file mode 100644 index ba92742f10..0000000000 --- a/tests/schema/pass/path_var_empty_pathitem.yaml +++ /dev/null @@ -1,6 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -paths: - /{var}: {} diff --git a/tests/schema/pass/schema.yaml b/tests/schema/pass/schema.yaml deleted file mode 100644 index e192529a68..0000000000 --- a/tests/schema/pass/schema.yaml +++ /dev/null @@ -1,55 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -paths: {} -components: - schemas: - model: - type: object - properties: - one: - description: type array - type: - - integer - - string - two: - description: type 'null' - type: "null" - three: - description: type array including 'null' - type: - - string - - "null" - four: - description: array with no items - type: array - five: - description: singular example - type: string - examples: - - exampleValue - six: - description: exclusiveMinimum true - exclusiveMinimum: 10 - seven: - description: exclusiveMinimum false - minimum: 10 - eight: - description: exclusiveMaximum true - exclusiveMaximum: 20 - nine: - description: exclusiveMaximum false - maximum: 20 - ten: - description: nullable string - type: - - string - - "null" - eleven: - description: x-nullable string - type: - - string - - "null" - twelve: - description: file/binary diff --git a/tests/schema/pass/servers.yaml b/tests/schema/pass/servers.yaml deleted file mode 100644 index 77a20498da..0000000000 --- a/tests/schema/pass/servers.yaml +++ /dev/null @@ -1,10 +0,0 @@ -openapi: 3.1.0 -info: - title: API - version: 1.0.0 -paths: {} -servers: - - url: /v1 - description: Run locally. - - url: https://production.com/v1 - description: Run on production server. diff --git a/tests/schema/pass/valid_schema_types.yaml b/tests/schema/pass/valid_schema_types.yaml deleted file mode 100644 index 4431adcda5..0000000000 --- a/tests/schema/pass/valid_schema_types.yaml +++ /dev/null @@ -1,14 +0,0 @@ -openapi: 3.1.1 - -# this example shows that top-level schemaObjects MAY be booleans - -info: - title: API - version: 1.0.0 -components: - schemas: - anything_boolean: true - nothing_boolean: false - anything_object: {} - nothing_object: { not: {} } - diff --git a/tests/schema/pass/webhook-example.yaml b/tests/schema/pass/webhook-example.yaml deleted file mode 100644 index 2ac1cda985..0000000000 --- a/tests/schema/pass/webhook-example.yaml +++ /dev/null @@ -1,35 +0,0 @@ -openapi: 3.1.0 -info: - title: Webhook Example - version: 1.0.0 -# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components -webhooks: - # Each webhook needs a name - newPet: - # This is a Path Item Object, the only difference is that the request is initiated by the API provider - post: - requestBody: - description: Information about a new pet in the system - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - responses: - "200": - description: Return a 200 status to indicate that the data was received successfully - -components: - schemas: - Pet: - required: - - id - - name - properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string - From 61b10629f9ab987bc9d11f9b247916911cdb7e9a Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:56:52 +0200 Subject: [PATCH 5/8] Delete tests/schema/schema.test.mjs --- tests/schema/schema.test.mjs | 38 ------------------------------------ 1 file changed, 38 deletions(-) delete mode 100644 tests/schema/schema.test.mjs diff --git a/tests/schema/schema.test.mjs b/tests/schema/schema.test.mjs deleted file mode 100644 index e7b84f0a74..0000000000 --- a/tests/schema/schema.test.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import { readdirSync, readFileSync } from "node:fs"; -import YAML from "yaml"; -import { describe, test, expect } from "vitest"; -import { registerSchema } from "@hyperjump/json-schema-coverage/vitest"; -import registerOasSchema from "./oas-schema.mjs"; - -const parseYamlFromFile = (filePath) => { - const schemaYaml = readFileSync(filePath, "utf8"); - return YAML.parse(schemaYaml, { prettyErrors: true }); -}; - -await registerOasSchema(); -await registerSchema("./src/schemas/validation/schema.yaml"); -const fixtures = './tests/schema'; - -describe("v3.1", () => { - describe("Pass", () => { - readdirSync(`${fixtures}/pass`, { withFileTypes: true }) - .filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name)) - .forEach((entry) => { - test(entry.name, async () => { - const instance = parseYamlFromFile(`${fixtures}/pass/${entry.name}`); - await expect(instance).to.matchJsonSchema("./src/schemas/validation/schema-base.yaml"); - }); - }); - }); - - describe("Fail", () => { - readdirSync(`${fixtures}/fail`, { withFileTypes: true }) - .filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name)) - .forEach((entry) => { - test(entry.name, async () => { - const instance = parseYamlFromFile(`${fixtures}/fail/${entry.name}`); - await expect(instance).to.not.matchJsonSchema("./src/schemas/validation/schema-base.yaml"); - }); - }); - }); -}); From 606a037d0e329fb27ae28af139316dfe7c18750b Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:57:19 +0200 Subject: [PATCH 6/8] Delete tests/schema/fail directory --- tests/schema/fail/invalid_schema_types.yaml | 13 ------------- tests/schema/fail/no_containers.yaml | 7 ------- tests/schema/fail/server_enum_empty.yaml | 14 -------------- tests/schema/fail/servers.yaml | 11 ----------- tests/schema/fail/unknown_container.yaml | 8 -------- 5 files changed, 53 deletions(-) delete mode 100644 tests/schema/fail/invalid_schema_types.yaml delete mode 100644 tests/schema/fail/no_containers.yaml delete mode 100644 tests/schema/fail/server_enum_empty.yaml delete mode 100644 tests/schema/fail/servers.yaml delete mode 100644 tests/schema/fail/unknown_container.yaml diff --git a/tests/schema/fail/invalid_schema_types.yaml b/tests/schema/fail/invalid_schema_types.yaml deleted file mode 100644 index d295b1f0ed..0000000000 --- a/tests/schema/fail/invalid_schema_types.yaml +++ /dev/null @@ -1,13 +0,0 @@ -openapi: 3.1.1 - -# this example shows invalid types for the schemaObject - -info: - title: API - version: 1.0.0 -components: - schemas: - invalid_null: null - invalid_number: 0 - invalid_array: [] - diff --git a/tests/schema/fail/no_containers.yaml b/tests/schema/fail/no_containers.yaml deleted file mode 100644 index c158bcb2b6..0000000000 --- a/tests/schema/fail/no_containers.yaml +++ /dev/null @@ -1,7 +0,0 @@ -openapi: 3.1.0 - -# this example should fail as there are no paths, components or webhooks containers (at least one of which must be present) - -info: - title: API - version: 1.0.0 diff --git a/tests/schema/fail/server_enum_empty.yaml b/tests/schema/fail/server_enum_empty.yaml deleted file mode 100644 index cd6d30eb3e..0000000000 --- a/tests/schema/fail/server_enum_empty.yaml +++ /dev/null @@ -1,14 +0,0 @@ -openapi: 3.1.0 - -# this example should fail as the server variable enum is empty, and so does not contain the default value - -info: - title: API - version: 1.0.0 -servers: - - url: https://example.com/{var} - variables: - var: - enum: [] - default: a -components: {} diff --git a/tests/schema/fail/servers.yaml b/tests/schema/fail/servers.yaml deleted file mode 100644 index 1470fe1ec8..0000000000 --- a/tests/schema/fail/servers.yaml +++ /dev/null @@ -1,11 +0,0 @@ -openapi: 3.1.0 - -# this example should fail, as servers must be an array, not an object - -info: - title: API - version: 1.0.0 -paths: {} -servers: - url: /v1 - description: Run locally. diff --git a/tests/schema/fail/unknown_container.yaml b/tests/schema/fail/unknown_container.yaml deleted file mode 100644 index 7f31e86053..0000000000 --- a/tests/schema/fail/unknown_container.yaml +++ /dev/null @@ -1,8 +0,0 @@ -openapi: 3.1.0 - -# this example should fail as overlays is not a valid top-level object/keyword - -info: - title: API - version: 1.0.0 -overlays: {} From 6dae3910ccc8e6014dd8084e46f50abcb354dd87 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 23 Sep 2025 17:27:25 +0000 Subject: [PATCH 7/8] move tests --- .../schemas/v3.0 => tests/schema}/pass/api-with-examples.yaml | 0 .../schemas/v3.0 => tests/schema}/pass/callback-example.yaml | 0 {_archive_/schemas/v3.0 => tests/schema}/pass/link-example.yaml | 0 .../schemas/v3.0 => tests/schema}/pass/petstore-expanded.yaml | 0 {_archive_/schemas/v3.0 => tests/schema}/pass/petstore.yaml | 0 {_archive_/schemas/v3.0 => tests/schema}/pass/uspto.yaml | 0 {_archive_/schemas/v3.0 => tests/schema}/schema.test.mjs | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename {_archive_/schemas/v3.0 => tests/schema}/pass/api-with-examples.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/pass/callback-example.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/pass/link-example.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/pass/petstore-expanded.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/pass/petstore.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/pass/uspto.yaml (100%) rename {_archive_/schemas/v3.0 => tests/schema}/schema.test.mjs (100%) diff --git a/_archive_/schemas/v3.0/pass/api-with-examples.yaml b/tests/schema/pass/api-with-examples.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/api-with-examples.yaml rename to tests/schema/pass/api-with-examples.yaml diff --git a/_archive_/schemas/v3.0/pass/callback-example.yaml b/tests/schema/pass/callback-example.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/callback-example.yaml rename to tests/schema/pass/callback-example.yaml diff --git a/_archive_/schemas/v3.0/pass/link-example.yaml b/tests/schema/pass/link-example.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/link-example.yaml rename to tests/schema/pass/link-example.yaml diff --git a/_archive_/schemas/v3.0/pass/petstore-expanded.yaml b/tests/schema/pass/petstore-expanded.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/petstore-expanded.yaml rename to tests/schema/pass/petstore-expanded.yaml diff --git a/_archive_/schemas/v3.0/pass/petstore.yaml b/tests/schema/pass/petstore.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/petstore.yaml rename to tests/schema/pass/petstore.yaml diff --git a/_archive_/schemas/v3.0/pass/uspto.yaml b/tests/schema/pass/uspto.yaml similarity index 100% rename from _archive_/schemas/v3.0/pass/uspto.yaml rename to tests/schema/pass/uspto.yaml diff --git a/_archive_/schemas/v3.0/schema.test.mjs b/tests/schema/schema.test.mjs similarity index 100% rename from _archive_/schemas/v3.0/schema.test.mjs rename to tests/schema/schema.test.mjs From b56237507606b24db3a2fe3c1e06d53f7a959fbb Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 25 Sep 2025 11:33:45 -0700 Subject: [PATCH 8/8] disallow component names not conforming to the pattern closes #3720 and #2439. --- src/schemas/validation/schema.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index acaf506eb5..5cf4a7a913 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -140,6 +140,7 @@ definitions: oneOf: - $ref: '#/definitions/Schema' - $ref: '#/definitions/Reference' + additionalProperties: false responses: type: object patternProperties: @@ -147,6 +148,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Response' + additionalProperties: false parameters: type: object patternProperties: @@ -154,6 +156,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Parameter' + additionalProperties: false examples: type: object patternProperties: @@ -161,6 +164,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Example' + additionalProperties: false requestBodies: type: object patternProperties: @@ -168,6 +172,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/RequestBody' + additionalProperties: false headers: type: object patternProperties: @@ -175,6 +180,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Header' + additionalProperties: false securitySchemes: type: object patternProperties: @@ -182,6 +188,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/SecurityScheme' + additionalProperties: false links: type: object patternProperties: @@ -189,6 +196,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Link' + additionalProperties: false callbacks: type: object patternProperties: @@ -196,6 +204,7 @@ definitions: oneOf: - $ref: '#/definitions/Reference' - $ref: '#/definitions/Callback' + additionalProperties: false patternProperties: '^x-': {} additionalProperties: false