diff --git a/.github/workflows/schema-publish.yaml b/.github/workflows/schema-publish.yaml index 0206ef56fa..7c52ecde93 100644 --- a/.github/workflows/schema-publish.yaml +++ b/.github/workflows/schema-publish.yaml @@ -4,14 +4,18 @@ name: schema-publish # issue: https://github.com/OAI/OpenAPI-Specification/issues/3715 # -# This workflow copies the 3.x schemas to the gh-pages branch +# This workflow creates a pull request for publishing schema iterations to the gh-pages branch # -# run this on push to main +# run this on push to vX.Y-dev branches or manually on: push: branches: - - main + - 'v?.?-dev' + paths: + - 'src/schemas/validation/*.yaml' + - 'scripts/schema-publish.sh' + - '.github/workflows/schema-publish.yaml' workflow_dispatch: {} jobs: @@ -26,7 +30,7 @@ jobs: - uses: actions/setup-node@v4 # setup Node.js with: - node-version: '20.x' + node-version: '22.x' - name: Install dependencies run: npm ci @@ -43,15 +47,15 @@ jobs: uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: publish-schema-iteration + branch: ${{ github.ref_name }}-publish-schema-iteration base: gh-pages delete-branch: true path: deploy labels: Housekeeping,Schema reviewers: darrelmiller,webron,earth2marsh,webron,lornajane,mikekistler,miqui,ralfhandl,handrews,karenetheridge - title: Publish OpenAPI Schema Iterations + title: '${{ github.ref_name }}: publish OpenAPI schema iterations' commit-message: New OpenAPI schema iterations signoff: true body: | - This pull request is automatically triggered by GitHub action `schema-publish`. - The `schemas/**/*.yaml` files have changed and JSON files are automatically generated. + This pull request is automatically generated by GitHub action `schema-publish`. + The `src/schemas/validation/*.yaml` files have changed and JSON files are automatically generated. diff --git a/schemas/v1.2/README.md b/schemas/v1.2/README.md deleted file mode 100644 index b443664da0..0000000000 --- a/schemas/v1.2/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Swagger Specification JSON Schemas - -The work on the JSON Schema for the Swagger Specification was donated to the community by [Francis Galiegue](https://github.com/fge)! - -Keep in mind that due to some JSON Schema limitations, not all constraints can be described. The missing constraints will be listed here in the future. diff --git a/schemas/v1.2/apiDeclaration.json b/schemas/v1.2/apiDeclaration.json deleted file mode 100644 index 4823b2069a..0000000000 --- a/schemas/v1.2/apiDeclaration.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/apiDeclaration.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ "swaggerVersion", "basePath", "apis" ], - "properties": { - "swaggerVersion": { "enum": [ "1.2" ] }, - "apiVersion": { "type": "string" }, - "basePath": { - "type": "string", - "format": "uri", - "pattern": "^https?://" - }, - "resourcePath": { - "type": "string", - "format": "uri", - "pattern": "^/" - }, - "apis": { - "type": "array", - "items": { "$ref": "#/definitions/apiObject" } - }, - "models": { - "type": "object", - "additionalProperties": { - "$ref": "modelsObject.json#" - } - }, - "produces": { "$ref": "#/definitions/mimeTypeArray" }, - "consumes": { "$ref": "#/definitions/mimeTypeArray" }, - "authorizations": { "$ref": "authorizationObject.json#" } - }, - "additionalProperties": false, - "definitions": { - "apiObject": { - "type": "object", - "required": [ "path", "operations" ], - "properties": { - "path": { - "type": "string", - "format": "uri-template", - "pattern": "^/" - }, - "description": { "type": "string" }, - "operations": { - "type": "array", - "items": { "$ref": "operationObject.json#" } - } - }, - "additionalProperties": false - }, - "mimeTypeArray": { - "type": "array", - "items": { - "type": "string", - "format": "mime-type" - }, - "uniqueItems": true - } - } -} diff --git a/schemas/v1.2/authorizationObject.json b/schemas/v1.2/authorizationObject.json deleted file mode 100644 index 82649701df..0000000000 --- a/schemas/v1.2/authorizationObject.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/authorizationObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuth" - }, - { - "$ref": "#/definitions/apiKey" - }, - { - "$ref": "#/definitions/oauth2" - } - ] - }, - "definitions": { - "basicAuth": { - "required": [ "type" ], - "properties": { - "type": { "enum": [ "basicAuth" ] } - }, - "additionalProperties": false - }, - "apiKey": { - "required": [ "type", "passAs", "keyname" ], - "properties": { - "type": { "enum": [ "apiKey" ] }, - "passAs": { "enum": [ "header", "query" ] }, - "keyname": { "type": "string" } - }, - "additionalProperties": false - }, - "oauth2": { - "type": "object", - "required": [ "type", "grantTypes" ], - "properties": { - "type": { "enum": [ "oauth2" ] }, - "scopes": { - "type": "array", - "items": { "$ref": "#/definitions/oauth2Scope" } - }, - "grantTypes": { "$ref": "oauth2GrantType.json#" } - }, - "additionalProperties": false - }, - "oauth2Scope": { - "type": "object", - "required": [ "scope" ], - "properties": { - "scope": { "type": "string" }, - "description": { "type": "string" } - }, - "additionalProperties": false - } - } -} - diff --git a/schemas/v1.2/dataType.json b/schemas/v1.2/dataType.json deleted file mode 100644 index 3e58c3b874..0000000000 --- a/schemas/v1.2/dataType.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/dataType.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Data type as described by the specification (version 1.2)", - "type": "object", - "oneOf": [ - { "$ref": "#/definitions/refType" }, - { "$ref": "#/definitions/voidType" }, - { "$ref": "#/definitions/primitiveType" }, - { "$ref": "#/definitions/modelType" }, - { "$ref": "#/definitions/arrayType" } - ], - "definitions": { - "refType": { - "required": [ "$ref" ], - "properties": { - "$ref": { "type": "string" } - }, - "additionalProperties": false - }, - "voidType": { - "enum": [ { "type": "void" } ] - }, - "modelType": { - "required": [ "type" ], - "properties": { - "type": { - "type": "string", - "not": { - "enum": [ "boolean", "integer", "number", "string", "array" ] - } - } - }, - "additionalProperties": false - }, - "primitiveType": { - "required": [ "type" ], - "properties": { - "type": { - "enum": [ "boolean", "integer", "number", "string" ] - }, - "format": { "type": "string" }, - "defaultValue": { - "not": { "type": [ "array", "object", "null" ] } - }, - "enum": { - "type": "array", - "items": { "type": "string" }, - "minItems": 1, - "uniqueItems": true - }, - "minimum": { "type": "string" }, - "maximum": { "type": "string" } - }, - "additionalProperties": false, - "dependencies": { - "format": { - "oneOf": [ - { - "properties": { - "type": { "enum": [ "integer" ] }, - "format": { "enum": [ "int32", "int64" ] } - } - }, - { - "properties": { - "type": { "enum": [ "number" ] }, - "format": { "enum": [ "float", "double" ] } - } - }, - { - "properties": { - "type": { "enum": [ "string" ] }, - "format": { - "enum": [ "byte", "date", "date-time" ] - } - } - } - ] - }, - "enum": { - "properties": { - "type": { "enum": [ "string" ] } - } - }, - "minimum": { - "properties": { - "type": { "enum": [ "integer", "number" ] } - } - }, - "maximum": { - "properties": { - "type": { "enum": [ "integer", "number" ] } - } - } - } - }, - "arrayType": { - "required": [ "type", "items" ], - "properties": { - "type": { "enum": [ "array" ] }, - "items": { - "type": "array", - "items": { "$ref": "#/definitions/itemsObject" } - }, - "uniqueItems": { "type": "boolean" } - }, - "additionalProperties": false - }, - "itemsObject": { - "oneOf": [ - { - "$ref": "#/definitions/refType" - }, - { - "allOf": [ - { - "$ref": "#/definitions/primitiveType" - }, - { - "properties": { - "type": {}, - "format": {} - }, - "additionalProperties": false - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/schemas/v1.2/dataTypeBase.json b/schemas/v1.2/dataTypeBase.json deleted file mode 100644 index 8320d6c23e..0000000000 --- a/schemas/v1.2/dataTypeBase.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/dataTypeBase.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Data type fields (section 4.3.3)", - "type": "object", - "oneOf": [ - { "required": [ "type" ] }, - { "required": [ "$ref" ] } - ], - "properties": { - "type": { "type": "string" }, - "$ref": { "type": "string" }, - "format": { "type": "string" }, - "defaultValue": { - "not": { "type": [ "array", "object", "null" ] } - }, - "enum": { - "type": "array", - "items": { "type": "string" }, - "uniqueItems": true, - "minItems": 1 - }, - "minimum": { "type": "string" }, - "maximum": { "type": "string" }, - "items": { "$ref": "#/definitions/itemsObject" }, - "uniqueItems": { "type": "boolean" } - }, - "dependencies": { - "format": { - "oneOf": [ - { - "properties": { - "type": { "enum": [ "integer" ] }, - "format": { "enum": [ "int32", "int64" ] } - } - }, - { - "properties": { - "type": { "enum": [ "number" ] }, - "format": { "enum": [ "float", "double" ] } - } - }, - { - "properties": { - "type": { "enum": [ "string" ] }, - "format": { - "enum": [ "byte", "date", "date-time" ] - } - } - } - ] - } - }, - "definitions": { - "itemsObject": { - "oneOf": [ - { - "type": "object", - "required": [ "$ref" ], - "properties": { - "$ref": { "type": "string" } - }, - "additionalProperties": false - }, - { - "allOf": [ - { "$ref": "#" }, - { - "required": [ "type" ], - "properties": { - "type": {}, - "format": {} - }, - "additionalProperties": false - } - ] - } - ] - } - } -} diff --git a/schemas/v1.2/infoObject.json b/schemas/v1.2/infoObject.json deleted file mode 100644 index f8819fe905..0000000000 --- a/schemas/v1.2/infoObject.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/infoObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "info object (section 5.1.3)", - "type": "object", - "required": [ "title", "description" ], - "properties": { - "title": { "type": "string" }, - "description": { "type": "string" }, - "termsOfServiceUrl": { "type": "string", "format": "uri" }, - "contact": { "type": "string", "format": "email" }, - "license": { "type": "string" }, - "licenseUrl": { "type": "string", "format": "uri" } - }, - "additionalProperties": false -} \ No newline at end of file diff --git a/schemas/v1.2/modelsObject.json b/schemas/v1.2/modelsObject.json deleted file mode 100644 index f591b39083..0000000000 --- a/schemas/v1.2/modelsObject.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/modelsObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ "id", "properties" ], - "properties": { - "id": { "type": "string" }, - "description": { "type": "string" }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#/definitions/propertyObject" } - }, - "subTypes": { - "type": "array", - "items": { "type": "string" }, - "uniqueItems": true - }, - "discriminator": { "type": "string" } - }, - "dependencies": { - "subTypes": [ "discriminator" ] - }, - "definitions": { - "propertyObject": { - "allOf": [ - { - "not": { "$ref": "#" } - }, - { - "$ref": "dataTypeBase.json#" - } - ] - } - } -} - diff --git a/schemas/v1.2/oauth2GrantType.json b/schemas/v1.2/oauth2GrantType.json deleted file mode 100644 index c9bac6ca55..0000000000 --- a/schemas/v1.2/oauth2GrantType.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/oauth2GrantType.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "minProperties": 1, - "properties": { - "implicit": { "$ref": "#/definitions/implicit" }, - "authorization_code": { "$ref": "#/definitions/authorizationCode" } - }, - "definitions": { - "implicit": { - "type": "object", - "required": [ "loginEndpoint" ], - "properties": { - "loginEndpoint": { "$ref": "#/definitions/loginEndpoint" }, - "tokenName": { "type": "string" } - }, - "additionalProperties": false - }, - "authorizationCode": { - "type": "object", - "required": [ "tokenEndpoint", "tokenRequestEndpoint" ], - "properties": { - "tokenEndpoint": { "$ref": "#/definitions/tokenEndpoint" }, - "tokenRequestEndpoint": { "$ref": "#/definitions/tokenRequestEndpoint" } - }, - "additionalProperties": false - }, - "loginEndpoint": { - "type": "object", - "required": [ "url" ], - "properties": { - "url": { "type": "string", "format": "uri" } - }, - "additionalProperties": false - }, - "tokenEndpoint": { - "type": "object", - "required": [ "url" ], - "properties": { - "url": { "type": "string", "format": "uri" }, - "tokenName": { "type": "string" } - }, - "additionalProperties": false - }, - "tokenRequestEndpoint": { - "type": "object", - "required": [ "url" ], - "properties": { - "url": { "type": "string", "format": "uri" }, - "clientIdName": { "type": "string" }, - "clientSecretName": { "type": "string" } - }, - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/schemas/v1.2/operationObject.json b/schemas/v1.2/operationObject.json deleted file mode 100644 index 5661251eb7..0000000000 --- a/schemas/v1.2/operationObject.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/operationObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "allOf": [ - { "$ref": "dataTypeBase.json#" }, - { - "required": [ "method", "nickname", "parameters" ], - "properties": { - "method": { "enum": [ "GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS" ] }, - "summary": { "type": "string" }, - "notes": { "type": "string" }, - "nickname": { - "type": "string", - "pattern": "^[a-zA-Z0-9_]+$" - }, - "authorizations": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "authorizationObject.json#/definitions/oauth2Scope" - } - } - }, - "parameters": { - "type": "array", - "items": { "$ref": "parameterObject.json#" } - }, - "responseMessages": { - "type": "array", - "items": { "$ref": "#/definitions/responseMessageObject"} - }, - "produces": { "$ref": "#/definitions/mimeTypeArray" }, - "consumes": { "$ref": "#/definitions/mimeTypeArray" }, - "deprecated": { "enum": [ "true", "false" ] } - } - } - ], - "definitions": { - "responseMessageObject": { - "type": "object", - "required": [ "code", "message" ], - "properties": { - "code": { "$ref": "#/definitions/rfc2616section10" }, - "message": { "type": "string" }, - "responseModel": { "type": "string" } - } - }, - "rfc2616section10": { - "type": "integer", - "minimum": 100, - "maximum": 600, - "exclusiveMaximum": true - }, - "mimeTypeArray": { - "type": "array", - "items": { - "type": "string", - "format": "mime-type" - }, - "uniqueItems": true - } - } -} diff --git a/schemas/v1.2/parameterObject.json b/schemas/v1.2/parameterObject.json deleted file mode 100644 index d762effe04..0000000000 --- a/schemas/v1.2/parameterObject.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/parameterObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "allOf": [ - { "$ref": "dataTypeBase.json#" }, - { - "required": [ "paramType", "name" ], - "properties": { - "paramType": { - "enum": [ "path", "query", "body", "header", "form" ] - }, - "name": { "type": "string" }, - "description": { "type": "string" }, - "required": { "type": "boolean" }, - "allowMultiple": { "type": "boolean" } - } - }, - { - "description": "type File requires special paramType and consumes", - "oneOf": [ - { - "properties": { - "type": { "not": { "enum": [ "File" ] } } - } - }, - { - "properties": { - "type": { "enum": [ "File" ] }, - "paramType": { "enum": [ "form" ] }, - "consumes": { "enum": [ "multipart/form-data" ] } - } - } - ] - } - ] -} diff --git a/schemas/v1.2/resourceListing.json b/schemas/v1.2/resourceListing.json deleted file mode 100644 index b5dd17d6d8..0000000000 --- a/schemas/v1.2/resourceListing.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/resourceListing.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ "swaggerVersion", "apis" ], - "properties": { - "swaggerVersion": { "enum": [ "1.2" ] }, - "apis": { - "type": "array", - "items": { "$ref": "resourceObject.json#" } - }, - "apiVersion": { "type": "string" }, - "info": { "$ref": "infoObject.json#" }, - "authorizations": { "$ref": "authorizationObject.json#" } - } -} diff --git a/schemas/v1.2/resourceObject.json b/schemas/v1.2/resourceObject.json deleted file mode 100644 index a88e83f562..0000000000 --- a/schemas/v1.2/resourceObject.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/resourceObject.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ "path" ], - "properties": { - "path": { "type": "string", "format": "uri" }, - "description": { "type": "string" } - }, - "additionalProperties": false -} \ No newline at end of file diff --git a/schemas/v2.0/README.md b/schemas/v2.0/README.md deleted file mode 100644 index 47b0c8e817..0000000000 --- a/schemas/v2.0/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# OpenAPI Specification v2.0 JSON Schema - -This is the JSON Schema file for the OpenAPI Specification version 2.0. Download and install it via NPM. - -## Install via NPM - -```shell -npm install --save swagger-schema-official -``` - -## License - -Apache-2.0 diff --git a/schemas/v2.0/schema.json b/schemas/v2.0/schema.json deleted file mode 100644 index a92e18f2a5..0000000000 --- a/schemas/v2.0/schema.json +++ /dev/null @@ -1,1607 +0,0 @@ -{ - "title": "A JSON Schema for Swagger 2.0 API.", - "id": "http://swagger.io/v2/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "swagger", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "swagger": { - "type": "string", - "enum": [ - "2.0" - ], - "description": "The Swagger version of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "host": { - "type": "string", - "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", - "description": "The host (name or ip) of the API. Example: 'swagger.io'" - }, - "basePath": { - "type": "string", - "pattern": "^/", - "description": "The base path to the API. Example: '/api'." - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "consumes": { - "description": "A list of MIME types accepted by the API.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "definitions": { - "$ref": "#/definitions/definitions" - }, - "parameters": { - "$ref": "#/definitions/parameterDefinitions" - }, - "responses": { - "$ref": "#/definitions/responseDefinitions" - }, - "security": { - "$ref": "#/definitions/security" - }, - "securityDefinitions": { - "$ref": "#/definitions/securityDefinitions" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "General information about the API.", - "required": [ - "version", - "title" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "A unique and precise title of the API." - }, - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, - "description": { - "type": "string", - "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." - }, - "termsOfService": { - "type": "string", - "description": "The terms of service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "license": { - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API." - }, - "parameterDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameter" - }, - "description": "One or more JSON representations for parameters" - }, - "responseDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response" - }, - "description": "One or more JSON representations for responses" - }, - "externalDocs": { - "type": "object", - "additionalProperties": false, - "description": "information about external documentation", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "examples": { - "type": "object", - "additionalProperties": true - }, - "mimeType": { - "type": "string", - "description": "The MIME type of the HTTP message." - }, - "operation": { - "type": "object", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string", - "description": "A brief summary of the operation." - }, - "description": { - "type": "string", - "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "A unique identifier of the operation." - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "consumes": { - "description": "A list of MIME types the API can consume.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "parameters": { - "$ref": "#/definitions/parametersList" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "security": { - "$ref": "#/definitions/security" - } - } - }, - "pathItem": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - } - } - }, - "responses": { - "type": "object", - "description": "Response objects names can either be any valid HTTP status code or 'default'.", - "minProperties": 1, - "additionalProperties": false, - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "not": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - } - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "response": { - "type": "object", - "required": [ - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/fileSchema" - } - ] - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "examples": { - "$ref": "#/definitions/examples" - } - }, - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "headers": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/header" - } - }, - "header": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "bodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "schema" - ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "body" - ] - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - }, - "headerParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "header" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "queryParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "formDataParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "formData" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "pathParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "required" - ], - "properties": { - "required": { - "type": "boolean", - "enum": [ - true - ], - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "path" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "nonBodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "type" - ], - "oneOf": [ - { - "$ref": "#/definitions/headerParameterSubSchema" - }, - { - "$ref": "#/definitions/formDataParameterSubSchema" - }, - { - "$ref": "#/definitions/queryParameterSubSchema" - }, - { - "$ref": "#/definitions/pathParameterSubSchema" - } - ] - }, - "parameter": { - "oneOf": [ - { - "$ref": "#/definitions/bodyParameter" - }, - { - "$ref": "#/definitions/nonBodyParameter" - } - ] - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "fileSchema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "type" - ], - "properties": { - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "type": { - "type": "string", - "enum": [ - "file" - ] - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "primitivesItems": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "securityRequirement": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "xml": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "securityDefinitions": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuthenticationSecurity" - }, - { - "$ref": "#/definitions/apiKeySecurity" - }, - { - "$ref": "#/definitions/oauth2ImplicitSecurity" - }, - { - "$ref": "#/definitions/oauth2PasswordSecurity" - }, - { - "$ref": "#/definitions/oauth2ApplicationSecurity" - }, - { - "$ref": "#/definitions/oauth2AccessCodeSecurity" - } - ] - } - }, - "basicAuthenticationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "basic" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "apiKeySecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "name", - "in" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "apiKey" - ] - }, - "name": { - "type": "string" - }, - "in": { - "type": "string", - "enum": [ - "header", - "query" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ImplicitSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "implicit" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2PasswordSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "password" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ApplicationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "application" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2AccessCodeSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "accessCode" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2Scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "mediaTypeList": { - "type": "array", - "items": { - "$ref": "#/definitions/mimeType" - }, - "uniqueItems": true - }, - "parametersList": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "additionalItems": false, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "uniqueItems": true - }, - "schemesList": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ - "http", - "https", - "ws", - "wss" - ] - }, - "uniqueItems": true - }, - "collectionFormat": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes" - ], - "default": "csv" - }, - "collectionFormatWithMulti": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes", - "multi" - ], - "default": "csv" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "jsonReference": { - "type": "object", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md deleted file mode 100644 index 5bda66cf5a..0000000000 --- a/schemas/v3.0/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# OpenAPI 3.0.X JSON Schema - -This directory contains the YAML source for generating the JSON Schema for validating OpenAPI definitions of versions 3.0.X, which is 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 source in this directory, which has `WORK-IN-PROGRESS` in its `id`, is _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 (in this case 3.0) 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.0/schema/2019-04-02` means this iteration was created on April 2nd, 2019. - -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. - -## Improving the schema - -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 `main` branch. - -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/v3.0) is part of this package. - -```bash -npm install -npm test -``` diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml deleted file mode 100644 index acaf506eb5..0000000000 --- a/schemas/v3.0/schema.yaml +++ /dev/null @@ -1,1031 +0,0 @@ -id: https://spec.openapis.org/oas/3.0/schema/WORK-IN-PROGRESS -$schema: http://json-schema.org/draft-04/schema# -description: The description of OpenAPI v3.0.x Documents -type: object -required: - - openapi - - info - - paths -properties: - openapi: - type: string - pattern: ^3\.0\.\d(-.+)?$ - info: - $ref: '#/definitions/Info' - externalDocs: - $ref: '#/definitions/ExternalDocumentation' - servers: - type: array - items: - $ref: '#/definitions/Server' - security: - type: array - items: - $ref: '#/definitions/SecurityRequirement' - tags: - type: array - items: - $ref: '#/definitions/Tag' - uniqueItems: true - paths: - $ref: '#/definitions/Paths' - components: - $ref: '#/definitions/Components' -patternProperties: - '^x-': {} -additionalProperties: false -definitions: - Reference: - type: object - required: - - $ref - patternProperties: - '^\$ref$': - type: string - format: uri-reference - Info: - type: object - required: - - title - - version - properties: - title: - type: string - description: - type: string - termsOfService: - type: string - format: uri-reference - contact: - $ref: '#/definitions/Contact' - license: - $ref: '#/definitions/License' - version: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - - Contact: - type: object - properties: - name: - type: string - url: - type: string - format: uri-reference - email: - type: string - format: email - patternProperties: - '^x-': {} - additionalProperties: false - - License: - type: object - required: - - name - properties: - name: - type: string - url: - type: string - format: uri-reference - patternProperties: - '^x-': {} - additionalProperties: false - - Server: - type: object - required: - - url - properties: - url: - type: string - description: - type: string - variables: - type: object - additionalProperties: - $ref: '#/definitions/ServerVariable' - patternProperties: - '^x-': {} - additionalProperties: false - - ServerVariable: - type: object - required: - - default - properties: - enum: - type: array - items: - type: string - default: - type: string - description: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - Components: - type: object - properties: - schemas: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - responses: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Response' - parameters: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Parameter' - examples: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Example' - requestBodies: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/RequestBody' - headers: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Header' - securitySchemes: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/SecurityScheme' - links: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Link' - callbacks: - type: object - patternProperties: - '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Callback' - patternProperties: - '^x-': {} - additionalProperties: false - - Schema: - type: object - properties: - title: - type: string - multipleOf: - type: number - minimum: 0 - exclusiveMinimum: true - maximum: - type: number - exclusiveMaximum: - type: boolean - default: false - minimum: - type: number - exclusiveMinimum: - type: boolean - default: false - maxLength: - type: integer - minimum: 0 - minLength: - type: integer - minimum: 0 - default: 0 - pattern: - type: string - format: regex - maxItems: - type: integer - minimum: 0 - minItems: - type: integer - minimum: 0 - default: 0 - uniqueItems: - type: boolean - default: false - maxProperties: - type: integer - minimum: 0 - minProperties: - type: integer - minimum: 0 - default: 0 - required: - type: array - items: - type: string - minItems: 1 - uniqueItems: true - enum: - type: array - items: {} - minItems: 1 - uniqueItems: false - type: - type: string - enum: - - array - - boolean - - integer - - number - - object - - string - not: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - allOf: - type: array - items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - oneOf: - type: array - items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - anyOf: - type: array - items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - properties: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - additionalProperties: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - - type: boolean - default: true - description: - type: string - format: - type: string - default: {} - nullable: - type: boolean - default: false - discriminator: - $ref: '#/definitions/Discriminator' - readOnly: - type: boolean - default: false - writeOnly: - type: boolean - default: false - example: {} - externalDocs: - $ref: '#/definitions/ExternalDocumentation' - deprecated: - type: boolean - default: false - xml: - $ref: '#/definitions/XML' - patternProperties: - '^x-': {} - additionalProperties: false - - Discriminator: - type: object - required: - - propertyName - properties: - propertyName: - type: string - mapping: - type: object - additionalProperties: - type: string - - XML: - type: object - properties: - name: - type: string - namespace: - type: string - format: uri - prefix: - type: string - attribute: - type: boolean - default: false - wrapped: - type: boolean - default: false - patternProperties: - '^x-': {} - additionalProperties: false - - Response: - type: object - required: - - description - properties: - description: - type: string - headers: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Header' - - $ref: '#/definitions/Reference' - content: - type: object - additionalProperties: - $ref: '#/definitions/MediaType' - links: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Link' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false - - MediaType: - type: object - properties: - schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - example: {} - examples: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - encoding: - type: object - additionalProperties: - $ref: '#/definitions/Encoding' - patternProperties: - '^x-': {} - additionalProperties: false - allOf: - - $ref: '#/definitions/ExampleXORExamples' - - Example: - type: object - properties: - summary: - type: string - description: - type: string - value: {} - externalValue: - type: string - format: uri-reference - patternProperties: - '^x-': {} - additionalProperties: false - - Header: - type: object - properties: - description: - type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - simple - default: simple - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - content: - type: object - additionalProperties: - $ref: '#/definitions/MediaType' - minProperties: 1 - maxProperties: 1 - example: {} - examples: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false - allOf: - - $ref: '#/definitions/ExampleXORExamples' - - $ref: '#/definitions/SchemaXORContent' - - Paths: - type: object - patternProperties: - '^\/': - $ref: '#/definitions/PathItem' - '^x-': {} - additionalProperties: false - - PathItem: - type: object - properties: - $ref: - type: string - summary: - type: string - description: - type: string - get: - $ref: '#/definitions/Operation' - put: - $ref: '#/definitions/Operation' - post: - $ref: '#/definitions/Operation' - delete: - $ref: '#/definitions/Operation' - options: - $ref: '#/definitions/Operation' - head: - $ref: '#/definitions/Operation' - patch: - $ref: '#/definitions/Operation' - trace: - $ref: '#/definitions/Operation' - servers: - type: array - items: - $ref: '#/definitions/Server' - parameters: - type: array - items: - oneOf: - - $ref: '#/definitions/Parameter' - - $ref: '#/definitions/Reference' - uniqueItems: true - patternProperties: - '^x-': {} - additionalProperties: false - - Operation: - type: object - required: - - responses - properties: - tags: - type: array - items: - type: string - summary: - type: string - description: - type: string - externalDocs: - $ref: '#/definitions/ExternalDocumentation' - operationId: - type: string - parameters: - type: array - items: - oneOf: - - $ref: '#/definitions/Parameter' - - $ref: '#/definitions/Reference' - uniqueItems: true - requestBody: - oneOf: - - $ref: '#/definitions/RequestBody' - - $ref: '#/definitions/Reference' - responses: - $ref: '#/definitions/Responses' - callbacks: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Callback' - - $ref: '#/definitions/Reference' - deprecated: - type: boolean - default: false - security: - type: array - items: - $ref: '#/definitions/SecurityRequirement' - servers: - type: array - items: - $ref: '#/definitions/Server' - patternProperties: - '^x-': {} - additionalProperties: false - - Responses: - type: object - properties: - default: - oneOf: - - $ref: '#/definitions/Response' - - $ref: '#/definitions/Reference' - patternProperties: - '^[1-5](?:\d{2}|XX)$': - oneOf: - - $ref: '#/definitions/Response' - - $ref: '#/definitions/Reference' - '^x-': {} - minProperties: 1 - additionalProperties: false - - - SecurityRequirement: - type: object - additionalProperties: - type: array - items: - type: string - - Tag: - type: object - required: - - name - properties: - name: - type: string - description: - type: string - externalDocs: - $ref: '#/definitions/ExternalDocumentation' - patternProperties: - '^x-': {} - additionalProperties: false - - ExternalDocumentation: - type: object - required: - - url - properties: - description: - type: string - url: - type: string - format: uri-reference - patternProperties: - '^x-': {} - additionalProperties: false - - ExampleXORExamples: - description: Example and examples are mutually exclusive - not: - required: [example, examples] - - SchemaXORContent: - description: Schema and content are mutually exclusive, at least one is required - not: - required: [schema, content] - oneOf: - - required: [schema] - - required: [content] - description: Some properties are not allowed if content is present - allOf: - - not: - required: [style] - - not: - required: [explode] - - not: - required: [allowReserved] - - not: - required: [example] - - not: - required: [examples] - - Parameter: - type: object - properties: - name: - type: string - in: - type: string - description: - type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - content: - type: object - additionalProperties: - $ref: '#/definitions/MediaType' - minProperties: 1 - maxProperties: 1 - example: {} - examples: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false - required: - - name - - in - allOf: - - $ref: '#/definitions/ExampleXORExamples' - - $ref: '#/definitions/SchemaXORContent' - oneOf: - - $ref: '#/definitions/PathParameter' - - $ref: '#/definitions/QueryParameter' - - $ref: '#/definitions/HeaderParameter' - - $ref: '#/definitions/CookieParameter' - - PathParameter: - description: Parameter in path - required: - - required - properties: - in: - enum: [path] - style: - enum: [matrix, label, simple] - default: simple - required: - enum: [true] - - QueryParameter: - description: Parameter in query - properties: - in: - enum: [query] - style: - enum: [form, spaceDelimited, pipeDelimited, deepObject] - default: form - - HeaderParameter: - description: Parameter in header - properties: - in: - enum: [header] - style: - enum: [simple] - default: simple - - CookieParameter: - description: Parameter in cookie - properties: - in: - enum: [cookie] - style: - enum: [form] - default: form - - RequestBody: - type: object - required: - - content - properties: - description: - type: string - content: - type: object - additionalProperties: - $ref: '#/definitions/MediaType' - required: - type: boolean - default: false - patternProperties: - '^x-': {} - additionalProperties: false - - SecurityScheme: - oneOf: - - $ref: '#/definitions/APIKeySecurityScheme' - - $ref: '#/definitions/HTTPSecurityScheme' - - $ref: '#/definitions/OAuth2SecurityScheme' - - $ref: '#/definitions/OpenIdConnectSecurityScheme' - - APIKeySecurityScheme: - type: object - required: - - type - - name - - in - properties: - type: - type: string - enum: - - apiKey - name: - type: string - in: - type: string - enum: - - header - - query - - cookie - description: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - HTTPSecurityScheme: - type: object - required: - - scheme - - type - properties: - scheme: - type: string - bearerFormat: - type: string - description: - type: string - type: - type: string - enum: - - http - patternProperties: - '^x-': {} - additionalProperties: false - oneOf: - - description: Bearer - properties: - scheme: - type: string - pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$ - - - description: Non Bearer - not: - required: [bearerFormat] - properties: - scheme: - not: - type: string - pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$ - - OAuth2SecurityScheme: - type: object - required: - - type - - flows - properties: - type: - type: string - enum: - - oauth2 - flows: - $ref: '#/definitions/OAuthFlows' - description: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - OpenIdConnectSecurityScheme: - type: object - required: - - type - - openIdConnectUrl - properties: - type: - type: string - enum: - - openIdConnect - openIdConnectUrl: - type: string - format: uri-reference - description: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - OAuthFlows: - type: object - properties: - implicit: - $ref: '#/definitions/ImplicitOAuthFlow' - password: - $ref: '#/definitions/PasswordOAuthFlow' - clientCredentials: - $ref: '#/definitions/ClientCredentialsFlow' - authorizationCode: - $ref: '#/definitions/AuthorizationCodeOAuthFlow' - patternProperties: - '^x-': {} - additionalProperties: false - - ImplicitOAuthFlow: - type: object - required: - - authorizationUrl - - scopes - properties: - authorizationUrl: - type: string - format: uri-reference - refreshUrl: - type: string - format: uri-reference - scopes: - type: object - additionalProperties: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - PasswordOAuthFlow: - type: object - required: - - tokenUrl - - scopes - properties: - tokenUrl: - type: string - format: uri-reference - refreshUrl: - type: string - format: uri-reference - scopes: - type: object - additionalProperties: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - ClientCredentialsFlow: - type: object - required: - - tokenUrl - - scopes - properties: - tokenUrl: - type: string - format: uri-reference - refreshUrl: - type: string - format: uri-reference - scopes: - type: object - additionalProperties: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - AuthorizationCodeOAuthFlow: - type: object - required: - - authorizationUrl - - tokenUrl - - scopes - properties: - authorizationUrl: - type: string - format: uri-reference - tokenUrl: - type: string - format: uri-reference - refreshUrl: - type: string - format: uri-reference - scopes: - type: object - additionalProperties: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - - Link: - type: object - properties: - operationId: - type: string - operationRef: - type: string - format: uri-reference - parameters: - type: object - additionalProperties: {} - requestBody: {} - description: - type: string - server: - $ref: '#/definitions/Server' - patternProperties: - '^x-': {} - additionalProperties: false - not: - description: Operation Id and Operation Ref are mutually exclusive - required: [operationId, operationRef] - - Callback: - type: object - additionalProperties: - $ref: '#/definitions/PathItem' - patternProperties: - '^x-': {} - - Encoding: - type: object - properties: - contentType: - type: string - headers: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Header' - - $ref: '#/definitions/Reference' - style: - type: string - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - explode: - type: boolean - allowReserved: - type: boolean - default: false - patternProperties: - '^x-': {} - additionalProperties: false diff --git a/schemas/v3.1/dialect.yaml b/schemas/v3.1/dialect.yaml deleted file mode 100644 index d300d94feb..0000000000 --- a/schemas/v3.1/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/schemas/v3.1/meta.yaml b/schemas/v3.1/meta.yaml deleted file mode 100644 index 6cfce4976d..0000000000 --- a/schemas/v3.1/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/schemas/v3.1/schema-base.yaml b/schemas/v3.1/schema-base.yaml deleted file mode 100644 index ea239c03e9..0000000000 --- a/schemas/v3.1/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/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml deleted file mode 100644 index 54c49a2f97..0000000000 --- a/schemas/v3.1/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 diff --git a/scripts/schema-publish.sh b/scripts/schema-publish.sh index d1a7f822bd..8e7ece48ec 100755 --- a/scripts/schema-publish.sh +++ b/scripts/schema-publish.sh @@ -4,51 +4,50 @@ # Run this script from the root of the repo. It is designed to be run by a GitHub workflow. -for schemaDir in schemas/v3* ; do - vVersion=$(basename "$schemaDir") - version=${vVersion:1} - echo $version - - # list of schemas to process, dependent schemas come first - schemas=(meta.yaml dialect.yaml schema.yaml schema-base.yaml) - - # find the newest commit date for each schema - maxDate="" - declare -A datesHash - for schema in "${schemas[@]}"; do - if [ -f "$schemaDir/$schema" ]; then - newestCommitDate=$(git log -1 --format="%ad" --date=short "$schemaDir/$schema") - - # the newest date across a schema and all its dependencies is its date stamp - if [ "$newestCommitDate" \> "$maxDate" ]; then - maxDate=$newestCommitDate - fi - datesHash["$schema"]=$maxDate - echo $schema changed at $newestCommitDate +schemaDir="src/schemas/validation" +branch=$(git branch --show-current) +version=${branch:1:3} +echo === Building schemas into ./deploy/oas/$version + +# list of schemas to process, dependent schemas come first +schemas=(meta.yaml dialect.yaml schema.yaml schema-base.yaml) + +# find the newest commit date for each schema +maxDate="" +declare -A datesHash +for schema in "${schemas[@]}"; do + if [ -f "$schemaDir/$schema" ]; then + newestCommitDate=$(git log -1 --format="%ad" --date=short "$schemaDir/$schema") + + # the newest date across a schema and all its dependencies is its date stamp + if [ "$newestCommitDate" \> "$maxDate" ]; then + maxDate=$newestCommitDate fi - done - - # construct sed command - sedCmd=() - for schema in "${!datesHash[@]}"; do - base=$(basename "$schema" .yaml) - sedCmd+=("-e s/$base\/WORK-IN-PROGRESS/$base\/${datesHash[$schema]}/g") - done + datesHash["$schema"]=$maxDate + echo $schema changed at $newestCommitDate + fi +done - # create the date-stamped schemas - for schema in "${!datesHash[@]}"; do - base=$(basename "$schema" .yaml) - target=deploy/oas/$version/$base/${datesHash[$schema]} +# construct sed command +sedCmd=() +for schema in "${!datesHash[@]}"; do + base=$(basename "$schema" .yaml) + sedCmd+=("-e s/$base\/WORK-IN-PROGRESS/$base\/${datesHash[$schema]}/g") +done - mkdir -p "deploy/oas/$version/$base" +# create the date-stamped schemas +for schema in "${!datesHash[@]}"; do + base=$(basename "$schema" .yaml) + target=deploy/oas/$version/$base/${datesHash[$schema]} - sed ${sedCmd[@]} $schemaDir/$schema > $target.yaml - node scripts/yaml2json/yaml2json.js $target.yaml - rm $target.yaml - mv $target.json $target + mkdir -p "deploy/oas/$version/$base" - mv deploy/oas/$version/$base/*.md $target.md - done + sed ${sedCmd[@]} $schemaDir/$schema > $target.yaml + node scripts/yaml2json/yaml2json.js $target.yaml + rm $target.yaml + mv $target.json $target - echo "" + mv deploy/oas/$version/$base/*.md $target.md done + +echo === Built diff --git a/scripts/schema-test-coverage.sh b/scripts/schema-test-coverage.sh index 0e4ed3883e..f7a10491f5 100755 --- a/scripts/schema-test-coverage.sh +++ b/scripts/schema-test-coverage.sh @@ -8,11 +8,4 @@ echo echo "Schema Test Coverage" echo -for schemaDir in schemas/v3* ; do - version=$(basename "$schemaDir") - echo $version - - node scripts/schema-test-coverage.mjs $schemaDir/schema.yaml tests/$version/pass - - echo -done \ No newline at end of file +node scripts/schema-test-coverage.mjs src/schemas/validation/schema.yaml tests/schema/pass diff --git a/schemas/v3.1/README.md b/src/schemas/validation/README.md similarity index 56% rename from schemas/v3.1/README.md rename to src/schemas/validation/README.md index a3d4c87ea0..2fdeb6999e 100644 --- a/schemas/v3.1/README.md +++ b/src/schemas/validation/README.md @@ -1,34 +1,34 @@ -# OpenAPI 3.1.X JSON Schema +# OpenAPI 3.X.Y JSON Schema -This directory contains the YAML sources for generating the JSON Schemas for validating OpenAPI definitions of versions 3.1.X, which are published on [https://spec.openapis.org](https://spec.openapis.org). +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, is _not intended for direct use_. - -## Choosing which schema to use - -There are two schemas to choose from for 3.1 usage, both of which have an `$id` that starts with `https://spec.openapis.org/oas/3.1/` and end with date or the `WORK-IN-PROGRESS` placeholder: - -* `https://spec.openapis.org/oas/3.1/schema/{date}` — A self-contained schema that _does not_ validate Schema Objects beyond `type: [object, boolean]` -* `https://spec.openapis.org/oas/3.1/meta/base/{date}` — The vocabulary metaschema for OAS 3.1's extensions to draft 2020-12 -* `https://spec.openapis.org/oas/3.1/dialect/base/{date}` — The dialect metaschema that extends the standard `draft/2020-12` metaschema by adding the OAS "base" vocabulary -* `https://spec.openapis.org/oas/3.1/schema-base/{date}` — 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 - -The name "base" for the dialect was intended to indicate that the OAS dialect could be further extended. - -An additional schema that validates the Schema Object with the OAS 3.1 dialect but does not restrict changing `$schema` is [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4147). +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 (in this case 3.0) to be updated independent of the spec patch release cycle. +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.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/base/{date}`, source: `base.yaml` — The dialect metaschema that extends the standard `draft/2020-12` metaschema by adding the OAS "base" vocabulary +* `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 + +The name "base" for the dialect was intended to indicate that the OAS dialect could be further extended. + +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. @@ -37,16 +37,16 @@ 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 `main` branch. +Improvements can be submitted by opening a PR against the `vX.Y-dev` branch of the respective specification version. -Modify the `*schema*.yaml` files and add test cases for your changes. +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/v3.1) is part of this package. +The [test suite](../../../tests/schema) is part of this package. ```bash npm install diff --git a/tests/v3.1/fail/invalid_schema_types.yaml b/tests/schema/fail/invalid_schema_types.yaml similarity index 100% rename from tests/v3.1/fail/invalid_schema_types.yaml rename to tests/schema/fail/invalid_schema_types.yaml diff --git a/tests/v3.1/fail/no_containers.yaml b/tests/schema/fail/no_containers.yaml similarity index 100% rename from tests/v3.1/fail/no_containers.yaml rename to tests/schema/fail/no_containers.yaml diff --git a/tests/v3.1/fail/server_enum_empty.yaml b/tests/schema/fail/server_enum_empty.yaml similarity index 100% rename from tests/v3.1/fail/server_enum_empty.yaml rename to tests/schema/fail/server_enum_empty.yaml diff --git a/tests/v3.1/fail/servers.yaml b/tests/schema/fail/servers.yaml similarity index 100% rename from tests/v3.1/fail/servers.yaml rename to tests/schema/fail/servers.yaml diff --git a/tests/v3.1/fail/unknown_container.yaml b/tests/schema/fail/unknown_container.yaml similarity index 100% rename from tests/v3.1/fail/unknown_container.yaml rename to tests/schema/fail/unknown_container.yaml diff --git a/tests/v3.1/pass/comp_pathitems.yaml b/tests/schema/pass/comp_pathitems.yaml similarity index 100% rename from tests/v3.1/pass/comp_pathitems.yaml rename to tests/schema/pass/comp_pathitems.yaml diff --git a/tests/v3.1/pass/info_summary.yaml b/tests/schema/pass/info_summary.yaml similarity index 100% rename from tests/v3.1/pass/info_summary.yaml rename to tests/schema/pass/info_summary.yaml diff --git a/tests/v3.1/pass/license_identifier.yaml b/tests/schema/pass/license_identifier.yaml similarity index 100% rename from tests/v3.1/pass/license_identifier.yaml rename to tests/schema/pass/license_identifier.yaml diff --git a/tests/v3.1/pass/mega.yaml b/tests/schema/pass/mega.yaml similarity index 100% rename from tests/v3.1/pass/mega.yaml rename to tests/schema/pass/mega.yaml diff --git a/tests/v3.1/pass/minimal_comp.yaml b/tests/schema/pass/minimal_comp.yaml similarity index 100% rename from tests/v3.1/pass/minimal_comp.yaml rename to tests/schema/pass/minimal_comp.yaml diff --git a/tests/v3.1/pass/minimal_hooks.yaml b/tests/schema/pass/minimal_hooks.yaml similarity index 100% rename from tests/v3.1/pass/minimal_hooks.yaml rename to tests/schema/pass/minimal_hooks.yaml diff --git a/tests/v3.1/pass/minimal_paths.yaml b/tests/schema/pass/minimal_paths.yaml similarity index 100% rename from tests/v3.1/pass/minimal_paths.yaml rename to tests/schema/pass/minimal_paths.yaml diff --git a/tests/v3.1/pass/non-oauth-scopes.yaml b/tests/schema/pass/non-oauth-scopes.yaml similarity index 100% rename from tests/v3.1/pass/non-oauth-scopes.yaml rename to tests/schema/pass/non-oauth-scopes.yaml diff --git a/tests/v3.1/pass/path_no_response.yaml b/tests/schema/pass/path_no_response.yaml similarity index 100% rename from tests/v3.1/pass/path_no_response.yaml rename to tests/schema/pass/path_no_response.yaml diff --git a/tests/v3.1/pass/path_var_empty_pathitem.yaml b/tests/schema/pass/path_var_empty_pathitem.yaml similarity index 100% rename from tests/v3.1/pass/path_var_empty_pathitem.yaml rename to tests/schema/pass/path_var_empty_pathitem.yaml diff --git a/tests/v3.1/pass/schema.yaml b/tests/schema/pass/schema.yaml similarity index 100% rename from tests/v3.1/pass/schema.yaml rename to tests/schema/pass/schema.yaml diff --git a/tests/v3.1/pass/servers.yaml b/tests/schema/pass/servers.yaml similarity index 100% rename from tests/v3.1/pass/servers.yaml rename to tests/schema/pass/servers.yaml diff --git a/tests/v3.1/pass/valid_schema_types.yaml b/tests/schema/pass/valid_schema_types.yaml similarity index 100% rename from tests/v3.1/pass/valid_schema_types.yaml rename to tests/schema/pass/valid_schema_types.yaml diff --git a/tests/v3.1/pass/webhook-example.yaml b/tests/schema/pass/webhook-example.yaml similarity index 100% rename from tests/v3.1/pass/webhook-example.yaml rename to tests/schema/pass/webhook-example.yaml diff --git a/tests/v3.1/schema.test.mjs b/tests/schema/schema.test.mjs similarity index 85% rename from tests/v3.1/schema.test.mjs rename to tests/schema/schema.test.mjs index 17a8b8a18b..17d1f9ce46 100644 --- a/tests/v3.1/schema.test.mjs +++ b/tests/schema/schema.test.mjs @@ -27,14 +27,15 @@ const parseYamlFromFile = (filePath) => { setMetaSchemaOutputFormat(BASIC); const validateOpenApi = await validate("./src/schemas/validation/schema.yaml"); +const fixtures = './tests/schema'; describe("v3.1", () => { describe("Pass", () => { - readdirSync(`./tests/v3.1/pass`, { withFileTypes: true }) + readdirSync(`${fixtures}/pass`, { withFileTypes: true }) .filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name)) .forEach((entry) => { test(entry.name, () => { - const instance = parseYamlFromFile(`./tests/v3.1/pass/${entry.name}`); + const instance = parseYamlFromFile(`${fixtures}/pass/${entry.name}`); const output = validateOpenApi(instance, BASIC); expect(output.valid).to.equal(true); }); @@ -42,11 +43,11 @@ describe("v3.1", () => { }); describe("Fail", () => { - readdirSync(`./tests/v3.1/fail`, { withFileTypes: true }) + readdirSync(`${fixtures}/fail`, { withFileTypes: true }) .filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name)) .forEach((entry) => { test(entry.name, () => { - const instance = parseYamlFromFile(`./tests/v3.1/fail/${entry.name}`); + const instance = parseYamlFromFile(`${fixtures}/fail/${entry.name}`); const output = validateOpenApi(instance, BASIC); expect(output.valid).to.equal(false); }); diff --git a/tests/v3.0/pass/api-with-examples.yaml b/tests/v3.0/pass/api-with-examples.yaml deleted file mode 100644 index 18726a5476..0000000000 --- a/tests/v3.0/pass/api-with-examples.yaml +++ /dev/null @@ -1,170 +0,0 @@ -openapi: "3.0.0" -info: - title: Simple API overview - version: 2.0.0 -paths: - /: - get: - operationId: listVersionsv2 - summary: List API versions - responses: - '200': - description: |- - 200 response - content: - application/json: - examples: - foo: - value: - { - "versions": [ - { - "status": "CURRENT", - "updated": "2011-01-21T11:33:21Z", - "id": "v2.0", - "links": [ - { - "href": "http://127.0.0.1:8774/v2/", - "rel": "self" - } - ] - }, - { - "status": "EXPERIMENTAL", - "updated": "2013-07-23T11:33:21Z", - "id": "v3.0", - "links": [ - { - "href": "http://127.0.0.1:8774/v3/", - "rel": "self" - } - ] - } - ] - } - '300': - description: |- - 300 response - content: - application/json: - examples: - foo: - value: | - { - "versions": [ - { - "status": "CURRENT", - "updated": "2011-01-21T11:33:21Z", - "id": "v2.0", - "links": [ - { - "href": "http://127.0.0.1:8774/v2/", - "rel": "self" - } - ] - }, - { - "status": "EXPERIMENTAL", - "updated": "2013-07-23T11:33:21Z", - "id": "v3.0", - "links": [ - { - "href": "http://127.0.0.1:8774/v3/", - "rel": "self" - } - ] - } - ] - } - /v2: - get: - operationId: getVersionDetailsv2 - summary: Show API version details - responses: - '200': - description: |- - 200 response - content: - application/json: - examples: - foo: - value: - { - "version": { - "status": "CURRENT", - "updated": "2011-01-21T11:33:21Z", - "media-types": [ - { - "base": "application/xml", - "type": "application/vnd.openstack.compute+xml;version=2" - }, - { - "base": "application/json", - "type": "application/vnd.openstack.compute+json;version=2" - } - ], - "id": "v2.0", - "links": [ - { - "href": "http://127.0.0.1:8774/v2/", - "rel": "self" - }, - { - "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", - "type": "application/pdf", - "rel": "describedby" - }, - { - "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", - "type": "application/vnd.sun.wadl+xml", - "rel": "describedby" - }, - { - "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", - "type": "application/vnd.sun.wadl+xml", - "rel": "describedby" - } - ] - } - } - '203': - description: |- - 203 response - content: - application/json: - examples: - foo: - value: - { - "version": { - "status": "CURRENT", - "updated": "2011-01-21T11:33:21Z", - "media-types": [ - { - "base": "application/xml", - "type": "application/vnd.openstack.compute+xml;version=2" - }, - { - "base": "application/json", - "type": "application/vnd.openstack.compute+json;version=2" - } - ], - "id": "v2.0", - "links": [ - { - "href": "http://23.253.228.211:8774/v2/", - "rel": "self" - }, - { - "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", - "type": "application/pdf", - "rel": "describedby" - }, - { - "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", - "type": "application/vnd.sun.wadl+xml", - "rel": "describedby" - } - ] - } - } diff --git a/tests/v3.0/pass/callback-example.yaml b/tests/v3.0/pass/callback-example.yaml deleted file mode 100644 index 262b8df518..0000000000 --- a/tests/v3.0/pass/callback-example.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.0 -info: - title: Callback Example - version: 1.0.0 -paths: - /streams: - post: - description: subscribes a client to receive out-of-band data - parameters: - - name: callbackUrl - in: query - required: true - description: | - the location where data will be sent. Must be network accessible - by the source server - schema: - type: string - format: uri - example: https://tonys-server.com - responses: - '201': - description: subscription successfully created - content: - application/json: - schema: - description: subscription information - required: - - subscriptionId - properties: - subscriptionId: - description: this unique identifier allows management of the subscription - type: string - example: 2531329f-fb09-4ef7-887e-84e648214436 - callbacks: - # the name `onData` is a convenience locator - onData: - # when data is sent, it will be sent to the `callbackUrl` provided - # when making the subscription PLUS the suffix `/data` - '{$request.query.callbackUrl}/data': - post: - requestBody: - description: subscription payload - content: - application/json: - schema: - type: object - properties: - timestamp: - type: string - format: date-time - userData: - type: string - responses: - '202': - description: | - Your server implementation should return this HTTP status code - if the data was received successfully - '204': - description: | - Your server should return this HTTP status code if no longer interested - in further updates diff --git a/tests/v3.0/pass/link-example.yaml b/tests/v3.0/pass/link-example.yaml deleted file mode 100644 index 5837d705ee..0000000000 --- a/tests/v3.0/pass/link-example.yaml +++ /dev/null @@ -1,203 +0,0 @@ -openapi: 3.0.0 -info: - title: Link Example - version: 1.0.0 -paths: - /2.0/users/{username}: - get: - operationId: getUserByName - parameters: - - name: username - in: path - required: true - schema: - type: string - responses: - '200': - description: The User - content: - application/json: - schema: - $ref: '#/components/schemas/user' - links: - userRepositories: - $ref: '#/components/links/UserRepositories' - /2.0/repositories/{username}: - get: - operationId: getRepositoriesByOwner - parameters: - - name: username - in: path - required: true - schema: - type: string - responses: - '200': - description: repositories owned by the supplied user - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/repository' - links: - userRepository: - $ref: '#/components/links/UserRepository' - /2.0/repositories/{username}/{slug}: - get: - operationId: getRepository - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - responses: - '200': - description: The repository - content: - application/json: - schema: - $ref: '#/components/schemas/repository' - links: - repositoryPullRequests: - $ref: '#/components/links/RepositoryPullRequests' - /2.0/repositories/{username}/{slug}/pullrequests: - get: - operationId: getPullRequestsByRepository - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: state - in: query - schema: - type: string - enum: - - open - - merged - - declined - responses: - '200': - description: an array of pull request objects - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/pullrequest' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}: - get: - operationId: getPullRequestsById - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: pid - in: path - required: true - schema: - type: string - responses: - '200': - description: a pull request object - content: - application/json: - schema: - $ref: '#/components/schemas/pullrequest' - links: - pullRequestMerge: - $ref: '#/components/links/PullRequestMerge' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: - post: - operationId: mergePullRequest - parameters: - - name: username - in: path - required: true - schema: - type: string - - name: slug - in: path - required: true - schema: - type: string - - name: pid - in: path - required: true - schema: - type: string - responses: - '204': - description: the PR was successfully merged -components: - links: - UserRepositories: - # returns array of '#/components/schemas/repository' - operationId: getRepositoriesByOwner - parameters: - username: $response.body#/username - UserRepository: - # returns '#/components/schemas/repository' - operationId: getRepository - parameters: - username: $response.body#/owner/username - slug: $response.body#/slug - RepositoryPullRequests: - # returns '#/components/schemas/pullrequest' - operationId: getPullRequestsByRepository - parameters: - username: $response.body#/owner/username - slug: $response.body#/slug - PullRequestMerge: - # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge - operationId: mergePullRequest - parameters: - username: $response.body#/author/username - slug: $response.body#/repository/slug - pid: $response.body#/id - schemas: - user: - type: object - properties: - username: - type: string - uuid: - type: string - repository: - type: object - properties: - slug: - type: string - owner: - $ref: '#/components/schemas/user' - pullrequest: - type: object - properties: - id: - type: integer - title: - type: string - repository: - $ref: '#/components/schemas/repository' - author: - $ref: '#/components/schemas/user' diff --git a/tests/v3.0/pass/petstore-expanded.yaml b/tests/v3.0/pass/petstore-expanded.yaml deleted file mode 100644 index 7e5bff0efa..0000000000 --- a/tests/v3.0/pass/petstore-expanded.yaml +++ /dev/null @@ -1,158 +0,0 @@ -openapi: "3.0.0" -info: - version: 1.0.0 - title: Swagger Petstore - description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification - termsOfService: http://swagger.io/terms/ - contact: - name: Swagger API Team - email: apiteam@swagger.io - url: http://swagger.io - license: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html -servers: - - url: https://petstore.swagger.io/v2 -paths: - /pets: - get: - description: | - Returns all pets from the system that the user has access to - Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. - - Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - operationId: findPets - parameters: - - name: tags - in: query - description: tags to filter by - required: false - style: form - schema: - type: array - items: - type: string - - name: limit - in: query - description: maximum number of results to return - required: false - schema: - type: integer - format: int32 - responses: - '200': - description: pet response - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Pet' - default: - description: unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - post: - description: Creates a new pet in the store. Duplicates are allowed - operationId: addPet - requestBody: - description: Pet to add to the store - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/NewPet' - responses: - '200': - description: pet response - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - default: - description: unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /pets/{id}: - get: - description: Returns a user based on a single ID, if the user does not have access to the pet - operationId: find pet by id - parameters: - - name: id - in: path - description: ID of pet to fetch - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: pet response - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - default: - description: unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - delete: - description: deletes a single pet based on the ID supplied - operationId: deletePet - parameters: - - name: id - in: path - description: ID of pet to delete - required: true - schema: - type: integer - format: int64 - responses: - '204': - description: pet deleted - default: - description: unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' -components: - schemas: - Pet: - allOf: - - $ref: '#/components/schemas/NewPet' - - type: object - required: - - id - properties: - id: - type: integer - format: int64 - - NewPet: - type: object - required: - - name - properties: - name: - type: string - tag: - type: string - - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/tests/v3.0/pass/petstore.yaml b/tests/v3.0/pass/petstore.yaml deleted file mode 100644 index 7ed987ff63..0000000000 --- a/tests/v3.0/pass/petstore.yaml +++ /dev/null @@ -1,119 +0,0 @@ -openapi: "3.0.0" -info: - version: 1.0.0 - title: Swagger Petstore - license: - name: MIT -servers: - - url: http://petstore.swagger.io/v1 -paths: - /pets: - get: - summary: List all pets - operationId: listPets - tags: - - pets - parameters: - - name: limit - in: query - description: How many items to return at one time (max 100) - required: false - schema: - type: integer - maximum: 100 - format: int32 - responses: - '200': - description: A paged array of pets - headers: - x-next: - description: A link to the next page of responses - schema: - type: string - content: - application/json: - schema: - $ref: "#/components/schemas/Pets" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - post: - summary: Create a pet - operationId: createPets - tags: - - pets - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - required: true - responses: - '201': - description: Null response - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /pets/{petId}: - get: - summary: Info for a specific pet - operationId: showPetById - tags: - - pets - parameters: - - name: petId - in: path - required: true - description: The id of the pet to retrieve - schema: - type: string - responses: - '200': - description: Expected response to a valid request - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Pet: - type: object - required: - - id - - name - properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string - Pets: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Pet" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/tests/v3.0/pass/uspto.yaml b/tests/v3.0/pass/uspto.yaml deleted file mode 100644 index d3011520d0..0000000000 --- a/tests/v3.0/pass/uspto.yaml +++ /dev/null @@ -1,210 +0,0 @@ -openapi: 3.0.1 -servers: - - url: '{scheme}://developer.uspto.gov/ds-api' - variables: - scheme: - description: 'The Data Set API is accessible via https and http' - enum: - - 'https' - - 'http' - default: 'https' -info: - description: >- - The Data Set API (DSAPI) allows the public users to discover and search - USPTO exported data sets. This is a generic API that allows USPTO users to - make any CSV based data files searchable through API. With the help of GET - call, it returns the list of data fields that are searchable. With the help - of POST call, data can be fetched based on the filters on the field names. - Please note that POST call is used to search the actual data. The reason for - the POST call is that it allows users to specify any complex search criteria - without worry about the GET size limitations as well as encoding of the - input parameters. - version: 1.0.0 - title: USPTO Data Set API - contact: - name: Open Data Portal - url: 'https://developer.uspto.gov' - email: developer@uspto.gov -tags: - - name: metadata - description: Find out about the data sets - - name: search - description: Search a data set -paths: - /: - get: - tags: - - metadata - operationId: list-data-sets - summary: List available data sets - responses: - '200': - description: Returns a list of data sets - content: - application/json: - schema: - $ref: '#/components/schemas/dataSetList' - example: - { - "total": 2, - "apis": [ - { - "apiKey": "oa_citations", - "apiVersionNumber": "v1", - "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields", - "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json" - }, - { - "apiKey": "cancer_moonshot", - "apiVersionNumber": "v1", - "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields", - "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json" - } - ] - } - /{dataset}/{version}/fields: - get: - tags: - - metadata - summary: >- - Provides the general information about the API and the list of fields - that can be used to query the dataset. - description: >- - This GET API returns the list of all the searchable field names that are - in the oa_citations. Please see the 'fields' attribute which returns an - array of field names. Each field or a combination of fields can be - searched using the syntax options shown below. - operationId: list-searchable-fields - parameters: - - name: dataset - in: path - description: 'Name of the dataset.' - required: true - example: "oa_citations" - schema: - type: string - - name: version - in: path - description: Version of the dataset. - required: true - example: "v1" - schema: - type: string - responses: - '200': - description: >- - The dataset API for the given version is found and it is accessible - to consume. - content: - application/json: - schema: - type: string - '404': - description: >- - The combination of dataset name and version is not found in the - system or it is not published yet to be consumed by public. - content: - application/json: - schema: - type: string - /{dataset}/{version}/records: - post: - tags: - - search - summary: >- - Provides search capability for the data set with the given search - criteria. - description: >- - This API is based on Solr/Lucene Search. The data is indexed using - SOLR. This GET API returns the list of all the searchable field names - that are in the Solr Index. Please see the 'fields' attribute which - returns an array of field names. Each field or a combination of fields - can be searched using the Solr/Lucene Syntax. Please refer - https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for - the query syntax. List of field names that are searchable can be - determined using above GET api. - operationId: perform-search - parameters: - - name: version - in: path - description: Version of the dataset. - required: true - schema: - type: string - default: v1 - - name: dataset - in: path - description: 'Name of the dataset. In this case, the default value is oa_citations' - required: true - schema: - type: string - default: oa_citations - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: array - items: - type: object - additionalProperties: - type: object - '404': - description: No matching record found for the given criteria. - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - properties: - criteria: - description: >- - Uses Lucene Query Syntax in the format of - propertyName:value, propertyName:[num1 TO num2] and date - range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the - response please see the 'docs' element which has the list of - record objects. Each record structure would consist of all - the fields and their corresponding values. - type: string - default: '*:*' - start: - description: Starting record number. Default value is 0. - type: integer - default: 0 - rows: - description: >- - Specify number of rows to be returned. If you run the search - with default values, in the response you will see 'numFound' - attribute which will tell the number of records available in - the dataset. - type: integer - default: 100 - required: - - criteria -components: - schemas: - dataSetList: - type: object - properties: - total: - type: integer - apis: - type: array - items: - type: object - properties: - apiKey: - type: string - description: To be used as a dataset parameter value - apiVersionNumber: - type: string - description: To be used as a version parameter value - apiUrl: - type: string - format: uriref - description: "The URL describing the dataset's fields" - apiDocumentationUrl: - type: string - format: uriref - description: A URL to the API console for each API diff --git a/tests/v3.0/schema.test.mjs b/tests/v3.0/schema.test.mjs deleted file mode 100644 index edc1bf7c42..0000000000 --- a/tests/v3.0/schema.test.mjs +++ /dev/null @@ -1,42 +0,0 @@ -import { readdirSync, readFileSync } from "node:fs"; -import YAML from "yaml"; -import { validate, setMetaSchemaOutputFormat } from "@hyperjump/json-schema/openapi-3-0"; -import { BASIC } from "@hyperjump/json-schema/experimental"; -import { describe, test, expect } from "vitest"; - -import contentTypeParser from "content-type"; -import { addMediaTypePlugin } from "@hyperjump/browser"; -import { buildSchemaDocument } from "@hyperjump/json-schema/experimental"; - -addMediaTypePlugin("application/schema+yaml", { - parse: async (response) => { - const contentType = contentTypeParser.parse(response.headers.get("content-type") ?? ""); - const contextDialectId = contentType.parameters.schema ?? contentType.parameters.profile; - - const foo = YAML.parse(await response.text()); - return buildSchemaDocument(foo, response.url, contextDialectId); - }, - fileMatcher: (path) => path.endsWith(".yaml") - }); - -const parseYamlFromFile = (filePath) => { - const schemaYaml = readFileSync(filePath, "utf8"); - return YAML.parse(schemaYaml, { prettyErrors: true }); -}; - -setMetaSchemaOutputFormat(BASIC); - -const validateOpenApi = await validate("./schemas/v3.0/schema.yaml"); -const folder = './tests/v3.0/pass/'; - -describe("pass", async () => { - readdirSync(folder, { withFileTypes: true }) - .filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name)) - .forEach((entry) => { - test(entry.name, () => { - const instance = parseYamlFromFile(folder + entry.name); - const output = validateOpenApi(instance, BASIC); - expect(output.valid).to.equal(true); - }); - }); -});