https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
@@ -0,0 +1,20 @@
Change Log
====================================================================================================
All notable changes will be documented in this file.
OpenAPI Schemas adheres to [Semantic Versioning](http://semver.org/).
[v2.0.0](https://github.com/APIDevTools/openapi-schemas/tree/v2.0.0) (2020-03-10)
----------------------------------------------------------------------------------------------------
- Moved OpenAPI Schemas to the [@APIDevTools scope](https://www.npmjs.com/org/apidevtools) on NPM
- The "openapi-schemas" NPM package is now just a wrapper around the scoped "@apidevtools/openapi-schemas" package
[Full Changelog](https://github.com/APIDevTools/openapi-schemas/compare/v1.0.3...v2.0.0)
[v1.0.0](https://github.com/APIDevTools/openapi-schemas/tree/v1.0.0) (2019-06-22)
----------------------------------------------------------------------------------------------------
Initial release 🎉
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 James Messinger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+116
View File
@@ -0,0 +1,116 @@
# OpenAPI Specification Schemas
[![Cross-Platform Compatibility](https://apitools.dev/img/badges/os-badges.svg)](https://github.com/APIDevTools/openapi-schemas/actions)
[![Build Status](https://github.com/APIDevTools/openapi-schemas/workflows/CI-CD/badge.svg?branch=master)](https://github.com/APIDevTools/openapi-schemas/actions)
[![Coverage Status](https://coveralls.io/repos/github/APIDevTools/openapi-schemas/badge.svg?branch=master)](https://coveralls.io/github/APIDevTools/openapi-schemas)
[![Dependencies](https://david-dm.org/APIDevTools/openapi-schemas.svg)](https://david-dm.org/APIDevTools/openapi-schemas)
[![npm](https://img.shields.io/npm/v/@apidevtools/openapi-schemas.svg)](https://www.npmjs.com/package/@apidevtools/openapi-schemas)
[![License](https://img.shields.io/npm/l/@apidevtools/openapi-schemas.svg)](LICENSE)
[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/APIDevTools/openapi-schemas)
This package contains [**the official JSON Schemas**](https://github.com/OAI/OpenAPI-Specification/tree/master/schemas) for every version of Swagger/OpenAPI Specification:
| Version | Schema | Docs
|---------|--------|-------
| Swagger 1.2 | [v1.2 schema](https://github.com/OAI/OpenAPI-Specification/tree/master/schemas/v1.2) | [v1.2 docs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/1.2.md)
| Swagger 2.0 | [v2.0 schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v2.0/schema.json) | [v2.0 docs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
| OpenAPI 3.0.x | [v3.0.x schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.json) | [v3.0.3 docs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md)
| OpenAPI 3.1.x | [v3.1.x schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.1/schema.json) | [v3.1.0 docs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md)
All schemas are kept up-to-date with the latest official definitions via an automated CI/CD job. 🤖📦
Installation
--------------------------
You can install OpenAPI Schemas via [npm](https://docs.npmjs.com/about-npm/).
```bash
npm install @apidevtools/openapi-schemas
```
Usage
--------------------------
The default export contains all OpenAPI Specification versions:
```javascript
const openapi = require("@apidevtools/openapi-schemas");
console.log(openapi.v1); // { $schema, id, properties, definitions, ... }
console.log(openapi.v2); // { $schema, id, properties, definitions, ... }
console.log(openapi.v3); // { $schema, id, properties, definitions, ... }
console.log(openapi.v31); // { $schema, id, properties, definitions, ... }
```
Or you can import the specific version(s) that you need:
```javascript
const { openapiV1, openapiV2, openapiV3, openapiV31 } = require("@apidevtools/openapi-schemas");
console.log(openapiV1); // { $schema, id, properties, definitions, ... }
console.log(openapiV2); // { $schema, id, properties, definitions, ... }
console.log(openapiV3); // { $schema, id, properties, definitions, ... }
console.log(openapiV31); // { $schema, id, properties, definitions, ... }
```
You can use a JSON Schema validator such as [Z-Schema](https://www.npmjs.com/package/z-schema) or [AJV](https://www.npmjs.com/package/ajv) to validate OpenAPI definitions against the specification.
```javascript
const { openapiV31 } = require("@apidevtools/openapi-schemas");
const ZSchema = require("z-schema");
// Create a ZSchema validator
let validator = new ZSchema();
// Validate an OpenAPI definition against the OpenAPI v3.0 specification
validator.validate(openapiDefinition, openapiV31);
```
Contributing
--------------------------
Contributions, enhancements, and bug-fixes are welcome! [Open an issue](https://github.com/APIDevTools/openapi-schemas/issues) on GitHub and [submit a pull request](https://github.com/APIDevTools/openapi-schemas/pulls).
#### Building
To build the project locally on your computer:
1. __Clone this repo__<br>
`git clone https://github.com/APIDevTools/openapi-schemas.git`
2. __Install dependencies__<br>
`npm install`
3. __Build the code__<br>
`npm run build`
4. __Run the tests__<br>
`npm test`
License
--------------------------
OpenAPI Schemas is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.
This package is [Treeware](http://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/APIDevTools/openapi-schemas) to thank us for our work. By contributing to the Treeware forest youll be creating employment for local families and restoring wildlife habitats.
Big Thanks To
--------------------------
Thanks to these awesome companies for their support of Open Source developers ❤
[![GitHub](https://apitools.dev/img/badges/github.svg)](https://github.com/open-source)
[![NPM](https://apitools.dev/img/badges/npm.svg)](https://www.npmjs.com/)
[![Coveralls](https://apitools.dev/img/badges/coveralls.svg)](https://coveralls.io)
[![Travis CI](https://apitools.dev/img/badges/travis-ci.svg)](https://travis-ci.com)
[![SauceLabs](https://apitools.dev/img/badges/sauce-labs.svg)](https://saucelabs.com)
@@ -0,0 +1,28 @@
import { JsonSchemaDraft4, JsonSchemaDraft202012 } from "./json-schema";
export { JsonSchemaDraft4, JsonSchemaDraft202012 };
/**
* JSON Schema for OpenAPI Specification v1.2
*/
export declare const openapiV1: JsonSchemaDraft4;
/**
* JSON Schema for OpenAPI Specification v2.0
*/
export declare const openapiV2: JsonSchemaDraft4;
/**
* JSON Schema for OpenAPI Specification v3.0
*/
export declare const openapiV3: JsonSchemaDraft4;
/**
* JSON Schema for OpenAPI Specification v3.1
*/
export declare const openapiV31: JsonSchemaDraft202012;
/**
* JSON Schemas for every version of the OpenAPI Specification
*/
export declare const openapi: {
v1: JsonSchemaDraft4;
v2: JsonSchemaDraft4;
v3: JsonSchemaDraft4;
v31: JsonSchemaDraft202012;
};
export default openapi;
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.openapi = exports.openapiV31 = exports.openapiV3 = exports.openapiV2 = exports.openapiV1 = void 0;
/**
* JSON Schema for OpenAPI Specification v1.2
*/
exports.openapiV1 = require("../schemas/v1.2/apiDeclaration.json");
/**
* JSON Schema for OpenAPI Specification v2.0
*/
exports.openapiV2 = require("../schemas/v2.0/schema.json");
/**
* JSON Schema for OpenAPI Specification v3.0
*/
exports.openapiV3 = require("../schemas/v3.0/schema.json");
/**
* JSON Schema for OpenAPI Specification v3.1
*/
exports.openapiV31 = require("../schemas/v3.1/schema.json");
/**
* JSON Schemas for every version of the OpenAPI Specification
*/
exports.openapi = {
v1: exports.openapiV1,
v2: exports.openapiV2,
v3: exports.openapiV3,
v31: exports.openapiV31,
};
// Export `openapi` as the default export
exports.default = exports.openapi;
// CommonJS default export hack
/* eslint-env commonjs */
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = Object.assign(module.exports.default, module.exports);
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACU,QAAA,SAAS,GAAG,OAAO,CAAC,qCAAqC,CAAqB,CAAC;AAE5F;;GAEG;AACU,QAAA,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAqB,CAAC;AAEpF;;GAEG;AACU,QAAA,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAqB,CAAC;AAEpF;;GAEG;AACU,QAAA,UAAU,GAAG,OAAO,CAAC,6BAA6B,CAA0B,CAAC;AAE1F;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,EAAE,EAAE,iBAAS;IACb,EAAE,EAAE,iBAAS;IACb,EAAE,EAAE,iBAAS;IACb,GAAG,EAAE,kBAAU;CAChB,CAAC;AAEF,yCAAyC;AACzC,kBAAe,eAAO,CAAC;AAEvB,+BAA+B;AAC/B,yBAAyB;AACzB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;IACpE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;CACxE"}
@@ -0,0 +1,88 @@
/**
* A JSON Schema 4.0 definition for an OpenAPI Specification
*/
export interface JsonSchemaDraft4 {
id?: string;
$schema?: string;
title?: string;
description?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
additionalItems?: boolean | JsonSchemaDraft4;
items?: JsonSchemaDraft4 | JsonSchemaDraft4[];
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
additionalProperties?: boolean | JsonSchemaDraft4;
definitions?: {
[name: string]: JsonSchemaDraft4;
};
properties?: {
[name: string]: JsonSchemaDraft4;
};
patternProperties?: {
[name: string]: JsonSchemaDraft4;
};
dependencies?: {
[name: string]: JsonSchemaDraft4 | string[];
};
enum?: string[];
type?: string | string[];
allOf?: JsonSchemaDraft4[];
anyOf?: JsonSchemaDraft4[];
oneOf?: JsonSchemaDraft4[];
not?: JsonSchemaDraft4;
}
/**
* A JSON Schema 2020-12 definition for an OpenAPI Specification
*/
export interface JsonSchemaDraft202012 {
$id?: string;
$schema?: string;
title?: string;
description?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
additionalItems?: boolean | JsonSchemaDraft202012;
items?: JsonSchemaDraft202012 | JsonSchemaDraft202012[];
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
additionalProperties?: boolean | JsonSchemaDraft202012;
$defs?: {
[name: string]: JsonSchemaDraft202012;
};
properties?: {
[name: string]: JsonSchemaDraft202012;
};
patternProperties?: {
[name: string]: JsonSchemaDraft202012;
};
dependencies?: {
[name: string]: JsonSchemaDraft202012 | string[];
};
enum?: string[];
type?: string | string[];
allOf?: JsonSchemaDraft202012[];
anyOf?: JsonSchemaDraft202012[];
oneOf?: JsonSchemaDraft202012[];
not?: JsonSchemaDraft202012;
}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=json-schema.js.map
@@ -0,0 +1 @@
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
{
"name": "@apidevtools/openapi-schemas",
"version": "2.1.0",
"description": "JSON Schemas for every version of the OpenAPI Specification",
"keywords": [
"openapi",
"open-api",
"swagger",
"oas",
"api",
"rest",
"json",
"specification",
"definition",
"schema"
],
"author": {
"name": "James Messinger",
"url": "https://jamesmessinger.com"
},
"license": "MIT",
"homepage": "https://apitools.dev/openapi-schemas",
"repository": {
"type": "git",
"url": "https://github.com/APIDevTools/openapi-schemas.git"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib",
"schemas"
],
"scripts": {
"clean": "shx rm -rf .nyc_output coverage lib .tmp schemas",
"clone": "git clone https://github.com/OAI/OpenAPI-Specification.git .tmp",
"copy": "shx cp -r .tmp/schemas schemas",
"lint": "eslint src test",
"build": "npm run build:schemas && npm run build:typescript",
"build:schemas": "npm run clean && npm run clone && npm run copy",
"build:typescript": "tsc",
"watch": "tsc --watch",
"test": "mocha && npm run lint",
"coverage": "nyc node_modules/mocha/bin/mocha",
"upgrade": "npm-check -u && npm audit fix",
"bump": "bump --tag --push --all",
"release": "npm run upgrade && npm run clean && npm run build && npm test && npm run bump"
},
"engines": {
"node": ">=10"
},
"devDependencies": {
"@jsdevtools/eslint-config": "^1.1.4",
"@jsdevtools/version-bump-prompt": "^6.1.0",
"@types/chai": "^4.2.17",
"@types/command-line-args": "^5.0.0",
"@types/mocha": "^8.2.2",
"@types/node": "^15.0.1",
"chai": "^4.3.4",
"eslint": "^7.25.0",
"mocha": "^8.3.2",
"npm-check": "^5.9.2",
"nyc": "^15.1.0",
"shx": "^0.3.3",
"typescript": "^4.2.4"
}
}
@@ -0,0 +1,5 @@
# 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.
@@ -0,0 +1,61 @@
{
"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
}
}
}
@@ -0,0 +1,59 @@
{
"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
}
}
}
@@ -0,0 +1,132 @@
{
"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
}
]
}
]
}
}
}
@@ -0,0 +1,81 @@
{
"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
}
]
}
]
}
}
}
@@ -0,0 +1,16 @@
{
"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
}
@@ -0,0 +1,36 @@
{
"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#"
}
]
}
}
}
@@ -0,0 +1,57 @@
{
"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
}
}
}
@@ -0,0 +1,65 @@
{
"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", "maxLength": 120 },
"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
}
}
}
@@ -0,0 +1,37 @@
{
"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" ] }
}
}
]
}
]
}
@@ -0,0 +1,16 @@
{
"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#" }
}
}
@@ -0,0 +1,11 @@
{
"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
}
@@ -0,0 +1,13 @@
# 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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,16 @@
OpenAPI 3.0.X JSON Schema
---
Here you can find the JSON Schema for validating OpenAPI definitions of versions 3.0.X.
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 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.
To submit improvements to the schema, modify the schema.yaml file only.
The TSC will then:
- Run tests on the updated schema
- Update the iteration version
- Convert the schema.yaml to schema.json
- Publish the new version
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,41 @@
# OpenAPI 3.1.X JSON Schema
Here you can find the JSON Schema for validating OpenAPI definitions of versions
3.1.X.
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 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.
The `schema.yaml` schema doesn't validate the JSON Schemas in your OpenAPI
document because 3.1 allows you to use any JSON Schema dialect you choose. We
have also included `schema-base.yaml` that extends the main schema to validate
that all schemas use the default OAS base vocabulary.
## Contributing
To submit improvements to the schema, modify the schema.yaml file only.
The TSC will then:
- Run tests on the updated schema
- Update the iteration version
- Convert the schema.yaml to schema.json
- Publish the new version
## Tests
The test suite is included as a git submodule of https://github.com/Mermade/openapi3-examples.
```bash
npx mocha --recursive tests
```
You can also validate a document individually.
```bash
scripts/validate.js path/to/document/to/validate.yaml
```
@@ -0,0 +1,21 @@
{
"$id": "https://spec.openapis.org/oas/3.1/dialect/base",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
"https://json-schema.org/draft/2020-12/vocab/content": true,
"https://spec.openapis.org/oas/3.1/vocab/base": false
},
"$dynamicAnchor": "meta",
"title": "OpenAPI 3.1 Schema Object Dialect",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/schema" },
{ "$ref": "https://spec.openapis.org/oas/3.1/meta/base" }
]
}
@@ -0,0 +1,79 @@
{
"$id": "https://spec.openapis.org/oas/3.1/meta/base",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://spec.openapis.org/oas/3.1/vocab/base": true
},
"$dynamicAnchor": "meta",
"title": "OAS Base vocabulary",
"type": ["object", "boolean"],
"properties": {
"example": true,
"discriminator": { "$ref": "#/$defs/discriminator" },
"externalDocs": { "$ref": "#/$defs/external-docs" },
"xml": { "$ref": "#/$defs/xml" }
},
"$defs": {
"extensible": {
"patternProperties": {
"^x-": true
}
},
"discriminator": {
"$ref": "#/$defs/extensible",
"type": "object",
"properties": {
"propertyName": {
"type": "string"
},
"mapping": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": ["propertyName"],
"unevaluatedProperties": false
},
"external-docs": {
"$ref": "#/$defs/extensible",
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri-reference"
},
"description": {
"type": "string"
}
},
"required": ["url"],
"unevaluatedProperties": false
},
"xml": {
"$ref": "#/$defs/extensible",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string",
"format": "uri"
},
"prefix": {
"type": "string"
},
"attribute": {
"type": "boolean"
},
"wrapped": {
"type": "boolean"
}
},
"unevaluatedProperties": false
}
}
}
@@ -0,0 +1,24 @@
{
"$id": "https://spec.openapis.org/oas/3.1/schema-base/2021-04-15",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "https://spec.openapis.org/oas/3.1/schema/2021-04-15",
"properties": {
"jsonSchemaDialect": {
"$ref": "#/$defs/dialect"
}
},
"$defs": {
"dialect": {
"const": "https://spec.openapis.org/oas/3.1/dialect/base"
},
"schema": {
"$dynamicAnchor": "meta",
"$ref\"": "https://spec.openapis.org/oas/3.1/dialect/base",
"properties": {
"$schema": {
"$ref": "#/$defs/dialect"
}
}
}
}
}
@@ -0,0 +1,17 @@
$id: 'https://spec.openapis.org/oas/3.1/schema-base/2021-04-15'
$schema: 'https://json-schema.org/draft/2020-12/schema'
$ref: 'https://spec.openapis.org/oas/3.1/schema/2021-04-15'
properties:
jsonSchemaDialect:
$ref: '#/$defs/dialect'
$defs:
dialect:
const: 'https://spec.openapis.org/oas/3.1/dialect/base'
schema:
$dynamicAnchor: meta
$ref": 'https://spec.openapis.org/oas/3.1/dialect/base'
properties:
$schema:
$ref: '#/$defs/dialect'
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,913 @@
$id: 'https://spec.openapis.org/oas/3.1/schema/2021-04-15'
$schema: 'https://json-schema.org/draft/2020-12/schema'
type: object
properties:
openapi:
type: string
pattern: '^3\.1\.\d+(-.+)?$'
info:
$ref: '#/$defs/info'
jsonSchemaDialect:
$ref: '#/$defs/uri'
default: 'https://spec.openapis.org/oas/3.1/dialect/base'
servers:
type: array
items:
$ref: '#/$defs/server'
paths:
$ref: '#/$defs/paths'
webhooks:
type: object
additionalProperties:
$ref: '#/$defs/path-item-or-reference'
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:
type: object
properties:
title:
type: string
summary:
type: string
description:
type: string
termsOfService:
type: string
contact:
$ref: '#/$defs/contact'
license:
$ref: '#/$defs/license'
version:
type: string
required:
- title
- version
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
contact:
type: object
properties:
name:
type: string
url:
type: string
email:
type: string
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
license:
type: object
properties:
name:
type: string
identifier:
type: string
url:
$ref: '#/$defs/uri'
required:
- name
oneOf:
- required:
- identifier
- required:
- url
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
server:
type: object
properties:
url:
$ref: '#/$defs/uri'
description:
type: string
variables:
type: object
additionalProperties:
$ref: '#/$defs/server-variable'
required:
- url
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
server-variable:
type: object
properties:
enum:
type: array
items:
type: string
minItems: 1
default:
type: string
descriptions:
type: string
required:
- default
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
components:
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-or-reference'
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:
type: object
patternProperties:
'^/':
$ref: '#/$defs/path-item'
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
path-item:
type: object
properties:
summary:
type: string
description:
type: string
servers:
type: array
items:
$ref: '#/$defs/server'
parameters:
type: array
items:
$ref: '#/$defs/parameter-or-reference'
patternProperties:
'^(get|put|post|delete|options|head|patch|trace)$':
$ref: '#/$defs/operation'
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
path-item-or-reference:
if:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/path-item'
operation:
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:
type: object
properties:
description:
type: string
url:
$ref: '#/$defs/uri'
required:
- url
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
parameter:
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
allowEmptyValue:
default: false
type: boolean
schema:
$dynamicRef: '#meta'
content:
$ref: '#/$defs/content'
required:
- in
oneOf:
- required:
- schema
- required:
- content
dependentSchemas:
schema:
properties:
style:
type: string
explode:
type: boolean
allowReserved:
default: false
type: boolean
allOf:
- $ref: '#/$defs/examples'
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path'
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header'
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query'
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie'
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form'
$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
enum:
- simple
styles-for-query:
if:
properties:
in:
const: query
required:
- in
then:
properties:
style:
default: form
enum:
- form
- spaceDelimited
- pipeDelimited
- deepObject
styles-for-cookie:
if:
properties:
in:
const: cookie
required:
- in
then:
properties:
style:
default: form
enum:
- form
styles-for-form:
if:
properties:
style:
const: form
required:
- style
then:
properties:
explode:
default: true
else:
properties:
explode:
default: false
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
parameter-or-reference:
if:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/parameter'
request-body:
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:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/request-body'
content:
type: object
additionalProperties:
$ref: '#/$defs/media-type'
propertyNames:
format: media-range
media-type:
type: object
properties:
schema:
$dynamicRef: '#meta'
encoding:
type: object
additionalProperties:
$ref: '#/$defs/encoding'
allOf:
- $ref: '#/$defs/specification-extensions'
- $ref: '#/$defs/examples'
unevaluatedProperties: false
encoding:
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/encoding/$defs/explode-default'
unevaluatedProperties: false
$defs:
explode-default:
if:
properties:
style:
const: form
required:
- style
then:
properties:
explode:
default: true
else:
properties:
explode:
default: false
responses:
type: object
properties:
default:
$ref: '#/$defs/response-or-reference'
patternProperties:
'^[1-5][0-9X]{2}$':
$ref: '#/$defs/response-or-reference'
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
response:
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:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/response'
callbacks:
type: object
$ref: '#/$defs/specification-extensions'
additionalProperties:
$ref: '#/$defs/path-item-or-reference'
callbacks-or-reference:
if:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/callbacks'
example:
type: object
properties:
summary:
type: string
description:
type: string
value: true
externalValue:
$ref: '#/$defs/uri'
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
example-or-reference:
if:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/example'
link:
type: object
properties:
operationRef:
$ref: '#/$defs/uri'
operationId: true
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:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/link'
header:
type: object
properties:
description:
type: string
required:
default: false
type: boolean
deprecated:
default: false
type: boolean
allowEmptyValue:
default: false
type: boolean
dependentSchemas:
schema:
properties:
style:
default: simple
enum:
- simple
explode:
default: false
type: boolean
allowReserved:
default: false
type: boolean
schema:
$dynamicRef: '#meta'
$ref: '#/$defs/examples'
content:
properties:
content:
$ref: '#/$defs/content'
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
header-or-reference:
if:
required:
- $ref
then:
$ref: '#/$defs/reference'
else:
$ref: '#/$defs/header'
tag:
type: object
properties:
name:
type: string
description:
type: string
externalDocs:
$ref: '#/$defs/external-documentation'
required:
- name
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
reference:
type: object
properties:
$ref:
$ref: '#/$defs/uri'
summary:
type: string
description:
type: string
unevaluatedProperties: false
schema:
$dynamicAnchor: meta
type:
- object
- boolean
security-scheme:
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:
const: bearer
required:
- type
- scheme
then:
properties:
bearerFormat:
type: string
required:
- scheme
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:
$ref: '#/$defs/uri'
required:
- openIdConnectUrl
security-scheme-or-reference:
if:
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
refreshUrl:
type: string
scopes:
$ref: '#/$defs/map-of-strings'
required:
- authorizationUrl
- scopes
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
password:
type: object
properties:
tokenUrl:
type: string
refreshUrl:
type: string
scopes:
$ref: '#/$defs/map-of-strings'
required:
- tokenUrl
- scopes
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
client-credentials:
type: object
properties:
tokenUrl:
type: string
refreshUrl:
type: string
scopes:
$ref: '#/$defs/map-of-strings'
required:
- tokenUrl
- scopes
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
authorization-code:
type: object
properties:
authorizationUrl:
type: string
tokenUrl:
type: string
refreshUrl:
type: string
scopes:
$ref: '#/$defs/map-of-strings'
required:
- authorizationUrl
- tokenUrl
- scopes
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false
security-requirement:
type: object
additionalProperties:
type: array
items:
type: string
specification-extensions:
patternProperties:
'^x-': true
examples:
properties:
example: true
examples:
type: object
additionalProperties:
$ref: '#/$defs/example-or-reference'
uri:
type: string
format: uri
map-of-strings:
type: object
additionalProperties:
type: string