diff --git a/.github/workflows/openapi_validate.yaml b/.github/workflows/openapi_validate.yaml new file mode 100644 index 00000000..6e884f15 --- /dev/null +++ b/.github/workflows/openapi_validate.yaml @@ -0,0 +1,21 @@ +name: Validate API docs + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Run Spectral + runs-on: ubuntu-latest + steps: + # Check out the repository + - uses: actions/checkout@v3 + + # Run Spectral + - uses: stoplightio/spectral-action@latest + with: + file_glob: 'api.yml' diff --git a/.stoplight/styleguide.json b/.stoplight/styleguide.json index 29c5c089..9ffa3bed 100644 --- a/.stoplight/styleguide.json +++ b/.stoplight/styleguide.json @@ -1478,9 +1478,7 @@ ], "library": { "cHJqOjEyMzU4Ng@33": { - "name": "Stoplight Style Guide", "description": "## Stoplight Style Guide\n\nStoplight's built-in style guide contains style and validation rules for OAS (OpenAPI specification) 2 and 3.x. \n\nThis built-in style guide is always initially enabled for Stoplight API projects. \n\nYou can:\n\n- Use the style guide as-is to [automatically lint](https://meta.stoplight.io/docs/platform/7975f76a794c4-validation-and-linting) your API files\n- [Disable individual rules](https://meta.stoplight.io/docs/platform/3f80fd36750e3-disable-inherited-rules) that do not follow your organization's standards\n- [Disable the entire style guide](https://meta.stoplight.io/docs/platform/ff8502dfbe156-enable-a-style-guide#disable-a-style-guide)\n- [Reuse and customtize rules](https://meta.stoplight.io/docs/platform/2331c5241ddfc) to meet your needs\n\n> For best results, never disable the `oas2-schema` and `oas3-schema` rules. These rules validate the structure of your API document against the OpenAPI specification.", - "spectralExtends": [], "formats": [ "oas2", "oas3", @@ -2775,104 +2773,92 @@ ] } }, + "spectralExtends": [], + "name": "Stoplight Style Guide", "x-embeddedFunctions": [ { "id": "7vlMlWLJeLfv6M_PHO36r", "extendedFrom": "", "name": "oasDocumentSchema", - "content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { oas2, oas3_1 } from '@stoplight/spectral-formats';\n\nconst OAS_2 = {\n title: 'A JSON Schema for Swagger 2.0 API.',\n $id: 'http://swagger.io/v2/schema.json#',\n $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'object',\n required: ['swagger', 'info', 'paths'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n swagger: {\n type: 'string',\n enum: ['2.0'],\n description: 'The Swagger version of this document.',\n },\n info: {\n $ref: '#/definitions/info',\n },\n host: {\n type: 'string',\n pattern: '^[^{}/ :\\\\\\\\]+(?::\\\\d+)?$',\n description: \"The host (name or ip) of the API. Example: 'swagger.io'\",\n },\n basePath: {\n type: 'string',\n pattern: '^/',\n description: \"The base path to the API. Example: '/api'.\",\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n consumes: {\n description: 'A list of MIME types accepted by the API.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n paths: {\n $ref: '#/definitions/paths',\n },\n definitions: {\n $ref: '#/definitions/definitions',\n },\n parameters: {\n $ref: '#/definitions/parameterDefinitions',\n },\n responses: {\n $ref: '#/definitions/responseDefinitions',\n },\n security: {\n $ref: '#/definitions/security',\n },\n securityDefinitions: {\n $ref: '#/definitions/securityDefinitions',\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/tag',\n },\n uniqueItems: true,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n definitions: {\n info: {\n type: 'object',\n description: 'General information about the API.',\n required: ['version', 'title'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n title: {\n type: 'string',\n description: 'A unique and precise title of the API.',\n },\n version: {\n type: 'string',\n description: 'A semantic version number of the API.',\n },\n description: {\n type: 'string',\n description:\n 'A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.',\n },\n termsOfService: {\n type: 'string',\n description: 'The terms of service for the API.',\n },\n contact: {\n $ref: '#/definitions/contact',\n },\n license: {\n $ref: '#/definitions/license',\n },\n },\n },\n contact: {\n type: 'object',\n description: 'Contact information for the owners of the API.',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: 'The identifying name of the contact person/organization.',\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the contact information.',\n format: 'uri',\n },\n email: {\n type: 'string',\n description: 'The email address of the contact person/organization.',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n license: {\n type: 'object',\n required: ['name'],\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: \"The name of the license type. It's encouraged to use an OSI compatible license.\",\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the license.',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n paths: {\n type: 'object',\n description: \"Relative paths to the individual endpoints. They must be relative to the 'basePath'.\",\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n '^/': {\n $ref: '#/definitions/pathItem',\n },\n },\n additionalProperties: false,\n },\n definitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n description: 'One or more JSON objects describing the schemas being consumed and produced by the API.',\n },\n parameterDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/parameter',\n },\n description: 'One or more JSON representations for parameters',\n },\n responseDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/response',\n },\n description: 'One or more JSON representations for responses',\n },\n externalDocs: {\n type: 'object',\n additionalProperties: false,\n description: 'information about external documentation',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n examples: {\n type: 'object',\n additionalProperties: true,\n },\n mimeType: {\n type: 'string',\n description: 'The MIME type of the HTTP message.',\n },\n operation: {\n type: 'object',\n required: ['responses'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n summary: {\n type: 'string',\n description: 'A brief summary of the operation.',\n },\n description: {\n type: 'string',\n description: 'A longer description of the operation, GitHub Flavored Markdown is allowed.',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n operationId: {\n type: 'string',\n description: 'A unique identifier of the operation.',\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n consumes: {\n description: 'A list of MIME types the API can consume.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n responses: {\n $ref: '#/definitions/responses',\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n $ref: '#/definitions/security',\n },\n },\n },\n pathItem: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n get: {\n $ref: '#/definitions/operation',\n },\n put: {\n $ref: '#/definitions/operation',\n },\n post: {\n $ref: '#/definitions/operation',\n },\n delete: {\n $ref: '#/definitions/operation',\n },\n options: {\n $ref: '#/definitions/operation',\n },\n head: {\n $ref: '#/definitions/operation',\n },\n patch: {\n $ref: '#/definitions/operation',\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n },\n },\n responses: {\n type: 'object',\n description: \"Response objects names can either be any valid HTTP status code or 'default'.\",\n minProperties: 1,\n additionalProperties: false,\n patternProperties: {\n '^([0-9]{3})$|^(default)$': {\n $ref: '#/definitions/responseValue',\n },\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n not: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n },\n responseValue: {\n oneOf: [\n {\n $ref: '#/definitions/response',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n $ref: '#/definitions/fileSchema',\n },\n ],\n },\n headers: {\n $ref: '#/definitions/headers',\n },\n examples: {\n $ref: '#/definitions/examples',\n },\n },\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/header',\n },\n },\n header: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n vendorExtension: {\n description: 'Any property starting with x- is valid.',\n additionalProperties: true,\n additionalItems: true,\n },\n bodyParameter: {\n type: 'object',\n required: ['name', 'in', 'schema'],\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['body'],\n },\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n schema: {\n $ref: '#/definitions/schema',\n },\n },\n additionalProperties: false,\n },\n headerParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['header'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n queryParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['query'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n formDataParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['formData'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array', 'file'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n pathParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['required'],\n properties: {\n required: {\n type: 'boolean',\n enum: [true],\n description: 'Determines whether or not this parameter is required or optional.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['path'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n nonBodyParameter: {\n type: 'object',\n required: ['name', 'in', 'type'],\n oneOf: [\n {\n $ref: '#/definitions/headerParameterSubSchema',\n },\n {\n $ref: '#/definitions/formDataParameterSubSchema',\n },\n {\n $ref: '#/definitions/queryParameterSubSchema',\n },\n {\n $ref: '#/definitions/pathParameterSubSchema',\n },\n ],\n },\n parameter: {\n oneOf: [\n {\n $ref: '#/definitions/bodyParameter',\n },\n {\n $ref: '#/definitions/nonBodyParameter',\n },\n ],\n },\n schema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/multipleOf',\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n maxProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n additionalProperties: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'boolean',\n },\n ],\n default: {},\n },\n type: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/type',\n },\n items: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n ],\n default: {},\n },\n allOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n oneOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n anyOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n properties: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n default: {},\n },\n discriminator: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/xml',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n fileSchema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['type'],\n properties: {\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n type: {\n type: 'string',\n enum: ['file'],\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n primitivesItems: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/securityRequirement',\n },\n uniqueItems: true,\n },\n securityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n },\n xml: {\n type: 'object',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n tag: {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n securityDefinitions: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/basicAuthenticationSecurity',\n },\n {\n $ref: '#/definitions/apiKeySecurity',\n },\n {\n $ref: '#/definitions/oauth2ImplicitSecurity',\n },\n {\n $ref: '#/definitions/oauth2PasswordSecurity',\n },\n {\n $ref: '#/definitions/oauth2ApplicationSecurity',\n },\n {\n $ref: '#/definitions/oauth2AccessCodeSecurity',\n },\n ],\n },\n errorMessage: {\n properties: {\n basic: 'Invalid basic authentication security definition',\n apiKey: 'Invalid apiKey authentication security definition',\n oauth2: 'Invalid oauth2 authentication security definition',\n },\n _: 'Invalid security securityDefinitions',\n },\n },\n basicAuthenticationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['basic'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n apiKeySecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ImplicitSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['implicit'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2PasswordSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['password'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ApplicationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['application'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2AccessCodeSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['accessCode'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2Scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n mediaTypeList: {\n type: 'array',\n items: {\n $ref: '#/definitions/mimeType',\n },\n uniqueItems: true,\n },\n parametersList: {\n type: 'array',\n description: 'The parameters needed to send a valid API call.',\n additionalItems: false,\n items: {\n oneOf: [\n {\n $ref: '#/definitions/parameter',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n uniqueItems: true,\n },\n schemesList: {\n type: 'array',\n description: 'The transfer protocol of the API.',\n items: {\n type: 'string',\n enum: ['http', 'https', 'ws', 'wss'],\n },\n uniqueItems: true,\n },\n collectionFormat: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes'],\n default: 'csv',\n },\n collectionFormatWithMulti: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes', 'multi'],\n default: 'csv',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n jsonReference: {\n type: 'object',\n required: ['$ref'],\n additionalProperties: false,\n properties: {\n $ref: {\n type: 'string',\n },\n },\n },\n },\n};\n\nconst OAS_3 = {\n $id: 'https://spec.openapis.org/oas/3.0/schema/2019-04-02',\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Validation schema for OpenAPI Specification 3.0.X.',\n type: 'object',\n required: ['openapi', 'info', 'paths'],\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.0\\\\.\\\\d(-.+)?$',\n },\n info: {\n $ref: '#/definitions/Info',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/Tag',\n },\n uniqueItems: true,\n },\n paths: {\n $ref: '#/definitions/Paths',\n },\n components: {\n $ref: '#/definitions/Components',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n definitions: {\n Reference: {\n type: 'object',\n required: ['$ref'],\n patternProperties: {\n '^\\\\$ref$': {\n type: 'string',\n format: 'uri-reference',\n },\n },\n },\n Info: {\n type: 'object',\n required: ['title', 'version'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n format: 'uri-reference',\n },\n contact: {\n $ref: '#/definitions/Contact',\n },\n license: {\n $ref: '#/definitions/License',\n },\n version: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n email: {\n type: 'string',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n License: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Server: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/ServerVariable',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ServerVariable: {\n type: 'object',\n required: ['default'],\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n responses: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Response',\n },\n ],\n },\n },\n },\n parameters: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Parameter',\n },\n ],\n },\n },\n },\n examples: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Example',\n },\n ],\n },\n },\n },\n requestBodies: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/RequestBody',\n },\n ],\n },\n },\n },\n headers: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Header',\n },\n ],\n },\n },\n },\n securitySchemes: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/SecurityScheme',\n },\n ],\n },\n },\n },\n links: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Link',\n },\n ],\n },\n },\n },\n callbacks: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Callback',\n },\n ],\n },\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'boolean',\n default: false,\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'boolean',\n default: false,\n },\n maxLength: {\n type: 'integer',\n minimum: 0,\n },\n minLength: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n maxItems: {\n type: 'integer',\n minimum: 0,\n },\n minItems: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n maxProperties: {\n type: 'integer',\n minimum: 0,\n },\n minProperties: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n required: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n uniqueItems: true,\n },\n enum: {\n type: 'array',\n items: {},\n minItems: 1,\n uniqueItems: false,\n },\n type: {\n type: 'string',\n enum: ['array', 'boolean', 'integer', 'number', 'object', 'string'],\n },\n not: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n allOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n oneOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n anyOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n properties: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n {\n type: 'boolean',\n },\n ],\n default: true,\n },\n description: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n default: {},\n nullable: {\n type: 'boolean',\n default: false,\n },\n discriminator: {\n $ref: '#/definitions/Discriminator',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n writeOnly: {\n type: 'boolean',\n default: false,\n },\n example: {},\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/XML',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Discriminator: {\n type: 'object',\n required: ['propertyName'],\n properties: {\n propertyName: {\n type: 'string',\n },\n mapping: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n },\n XML: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n format: 'uri',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Header',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Link',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n MediaType: {\n type: 'object',\n properties: {\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Encoding',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n ],\n },\n Example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: {},\n externalValue: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n enum: ['simple'],\n default: 'simple',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n ],\n },\n Paths: {\n type: 'object',\n patternProperties: {\n '^\\\\/': {\n $ref: '#/definitions/PathItem',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n PathItem: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/definitions/Operation',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n Operation: {\n type: 'object',\n required: ['responses'],\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n requestBody: {\n oneOf: [\n {\n $ref: '#/definitions/RequestBody',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n responses: {\n $ref: '#/definitions/Responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Callback',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Responses: {\n type: 'object',\n properties: {\n default: {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n patternProperties: {\n '^[1-5](?:\\\\d{2}|XX)$': {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n '^x-': {},\n },\n minProperties: 1,\n additionalProperties: false,\n },\n SecurityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExternalDocumentation: {\n type: 'object',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExampleXORExamples: {\n description: 'Example and examples are mutually exclusive',\n not: {\n required: ['example', 'examples'],\n },\n },\n SchemaXORContent: {\n description: 'Schema and content are mutually exclusive, at least one is required',\n not: {\n required: ['schema', 'content'],\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n description: 'Some properties are not allowed if content is present',\n allOf: [\n {\n not: {\n required: ['style'],\n },\n },\n {\n not: {\n required: ['explode'],\n },\n },\n {\n not: {\n required: ['allowReserved'],\n },\n },\n {\n not: {\n required: ['example'],\n },\n },\n {\n not: {\n required: ['examples'],\n },\n },\n ],\n },\n ],\n },\n Parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n required: ['name', 'in'],\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n {\n $ref: '#/definitions/ParameterLocation',\n },\n ],\n },\n ParameterLocation: {\n description: 'Parameter location',\n oneOf: [\n {\n description: 'Parameter in path',\n required: ['required'],\n properties: {\n in: {\n enum: ['path'],\n },\n style: {\n enum: ['matrix', 'label', 'simple'],\n default: 'simple',\n },\n required: {\n enum: [true],\n },\n },\n },\n {\n description: 'Parameter in query',\n properties: {\n in: {\n enum: ['query'],\n },\n style: {\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n default: 'form',\n },\n },\n },\n {\n description: 'Parameter in header',\n properties: {\n in: {\n enum: ['header'],\n },\n style: {\n enum: ['simple'],\n default: 'simple',\n },\n },\n },\n {\n description: 'Parameter in cookie',\n properties: {\n in: {\n enum: ['cookie'],\n },\n style: {\n enum: ['form'],\n default: 'form',\n },\n },\n },\n ],\n },\n RequestBody: {\n type: 'object',\n required: ['content'],\n properties: {\n description: {\n type: 'string',\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n required: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n SecurityScheme: {\n oneOf: [\n {\n $ref: '#/definitions/APIKeySecurityScheme',\n },\n {\n $ref: '#/definitions/HTTPSecurityScheme',\n },\n {\n $ref: '#/definitions/OAuth2SecurityScheme',\n },\n {\n $ref: '#/definitions/OpenIdConnectSecurityScheme',\n },\n ],\n },\n APIKeySecurityScheme: {\n type: 'object',\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query', 'cookie'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n HTTPSecurityScheme: {\n type: 'object',\n required: ['scheme', 'type'],\n properties: {\n scheme: {\n type: 'string',\n },\n bearerFormat: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: ['http'],\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n oneOf: [\n {\n description: 'Bearer',\n properties: {\n scheme: {\n enum: ['bearer'],\n },\n },\n },\n {\n description: 'Non Bearer',\n not: {\n required: ['bearerFormat'],\n },\n properties: {\n scheme: {\n not: {\n enum: ['bearer'],\n },\n },\n },\n },\n ],\n },\n OAuth2SecurityScheme: {\n type: 'object',\n required: ['type', 'flows'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flows: {\n $ref: '#/definitions/OAuthFlows',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OpenIdConnectSecurityScheme: {\n type: 'object',\n required: ['type', 'openIdConnectUrl'],\n properties: {\n type: {\n type: 'string',\n enum: ['openIdConnect'],\n },\n openIdConnectUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OAuthFlows: {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/definitions/ImplicitOAuthFlow',\n },\n password: {\n $ref: '#/definitions/PasswordOAuthFlow',\n },\n clientCredentials: {\n $ref: '#/definitions/ClientCredentialsFlow',\n },\n authorizationCode: {\n $ref: '#/definitions/AuthorizationCodeOAuthFlow',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ImplicitOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n PasswordOAuthFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ClientCredentialsFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n AuthorizationCodeOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Link: {\n type: 'object',\n properties: {\n operationId: {\n type: 'string',\n },\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n parameters: {\n type: 'object',\n additionalProperties: {},\n },\n requestBody: {},\n description: {\n type: 'string',\n },\n server: {\n $ref: '#/definitions/Server',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n not: {\n description: 'Operation Id and Operation Ref are mutually exclusive',\n required: ['operationId', 'operationRef'],\n },\n },\n Callback: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/PathItem',\n },\n patternProperties: {\n '^x-': {},\n },\n },\n Encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Header',\n },\n },\n style: {\n type: 'string',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nconst OAS_3_1 = {\n $id: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28',\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.1\\\\.\\\\d+(-.+)?$',\n },\n info: {\n $ref: '#/$defs/info',\n },\n jsonSchemaDialect: {\n type: 'string',\n format: 'uri',\n default: 'https://spec.openapis.org/oas/3.1/dialect/base',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n paths: {\n $ref: '#/$defs/paths',\n },\n webhooks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n components: {\n $ref: '#/$defs/components',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/$defs/tag',\n },\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['openapi', 'info'],\n anyOf: [\n {\n required: ['paths'],\n errorMessage: 'The document must have either \"paths\", \"webhooks\" or \"components\"',\n },\n {\n required: ['components'],\n },\n {\n required: ['webhooks'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n info: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n },\n contact: {\n $ref: '#/$defs/contact',\n },\n license: {\n $ref: '#/$defs/license',\n },\n version: {\n type: 'string',\n },\n },\n required: ['title', 'version'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n email: {\n type: 'string',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n license: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n identifier: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['name'],\n oneOf: [\n {\n required: ['identifier'],\n },\n {\n required: ['url'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n server: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n format: 'uri-template',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/server-variable',\n },\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'server-variable': {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n required: ['default'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/schema',\n },\n },\n responses: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n parameters: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n requestBodies: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/request-body-or-reference',\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n securitySchemes: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/security-scheme-or-reference',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n pathItems: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n },\n patternProperties: {\n '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$': {\n $comment:\n 'Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected',\n propertyNames: {\n pattern: '^[a-zA-Z0-9._-]+$',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n paths: {\n type: 'object',\n patternProperties: {\n '^/': {\n $ref: '#/$defs/path-item',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item': {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/$defs/operation',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/path-item',\n },\n },\n operation: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n requestBody: {\n $ref: '#/$defs/request-body-or-reference',\n },\n responses: {\n $ref: '#/$defs/responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'external-documentation': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'path', 'cookie'],\n },\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n allowEmptyValue: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n required: ['in'],\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/examples',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form',\n },\n ],\n $defs: {\n 'styles-for-path': {\n if: {\n properties: {\n in: {\n const: 'path',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n name: {\n pattern: '[^/#?]+$',\n },\n style: {\n default: 'simple',\n enum: ['matrix', 'label', 'simple'],\n },\n required: {\n const: true,\n },\n },\n required: ['required'],\n },\n },\n 'styles-for-header': {\n if: {\n properties: {\n in: {\n const: 'header',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n },\n },\n },\n 'styles-for-query': {\n if: {\n properties: {\n in: {\n const: 'query',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n },\n },\n },\n 'styles-for-cookie': {\n if: {\n properties: {\n in: {\n const: 'cookie',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n const: 'form',\n },\n },\n },\n },\n 'styles-for-form': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'parameter-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/parameter',\n },\n },\n 'request-body': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n content: {\n $ref: '#/$defs/content',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n },\n required: ['content'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'request-body-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/request-body',\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/media-type',\n },\n propertyNames: {\n format: 'media-range',\n },\n },\n 'media-type': {\n type: 'object',\n properties: {\n schema: {\n $ref: '#/$defs/schema',\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/encoding',\n },\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/examples',\n },\n ],\n unevaluatedProperties: false,\n },\n encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n format: 'media-range',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/encoding/$defs/explode-default',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'explode-default': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n responses: {\n type: 'object',\n properties: {\n default: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n patternProperties: {\n '^[1-5](?:[0-9]{2}|XX)$': {\n $ref: '#/$defs/response-or-reference',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n response: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n content: {\n $ref: '#/$defs/content',\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n },\n required: ['description'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'response-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/response',\n },\n },\n callbacks: {\n type: 'object',\n $ref: '#/$defs/specification-extensions',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n 'callbacks-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/callbacks',\n },\n },\n example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: true,\n externalValue: {\n type: 'string',\n format: 'uri',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'example-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/example',\n },\n },\n link: {\n type: 'object',\n properties: {\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n operationId: true,\n parameters: {\n $ref: '#/$defs/map-of-strings',\n },\n requestBody: true,\n description: {\n type: 'string',\n },\n body: {\n $ref: '#/$defs/server',\n },\n },\n oneOf: [\n {\n required: ['operationRef'],\n },\n {\n required: ['operationId'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'link-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/link',\n },\n },\n header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n explode: {\n default: false,\n type: 'boolean',\n },\n },\n $ref: '#/$defs/examples',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'header-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/header',\n },\n },\n tag: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['name'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n reference: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n unevaluatedProperties: false,\n },\n schema: {\n $dynamicAnchor: 'meta',\n type: ['object', 'boolean'],\n },\n 'security-scheme': {\n type: 'object',\n properties: {\n type: {\n enum: ['apiKey', 'http', 'mutualTLS', 'oauth2', 'openIdConnect'],\n },\n description: {\n type: 'string',\n },\n },\n required: ['type'],\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-apikey',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http-bearer',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oauth2',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oidc',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'type-apikey': {\n if: {\n properties: {\n type: {\n const: 'apiKey',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'cookie'],\n },\n },\n required: ['name', 'in'],\n },\n },\n 'type-http': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n scheme: {\n type: 'string',\n },\n },\n required: ['scheme'],\n },\n },\n 'type-http-bearer': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n scheme: {\n type: 'string',\n pattern: '^[Bb][Ee][Aa][Rr][Ee][Rr]$',\n },\n },\n required: ['type', 'scheme'],\n },\n then: {\n properties: {\n bearerFormat: {\n type: 'string',\n },\n },\n },\n },\n 'type-oauth2': {\n if: {\n properties: {\n type: {\n const: 'oauth2',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n flows: {\n $ref: '#/$defs/oauth-flows',\n },\n },\n required: ['flows'],\n },\n },\n 'type-oidc': {\n if: {\n properties: {\n type: {\n const: 'openIdConnect',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n openIdConnectUrl: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['openIdConnectUrl'],\n },\n },\n },\n },\n 'security-scheme-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/security-scheme',\n },\n },\n 'oauth-flows': {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/$defs/oauth-flows/$defs/implicit',\n },\n password: {\n $ref: '#/$defs/oauth-flows/$defs/password',\n },\n clientCredentials: {\n $ref: '#/$defs/oauth-flows/$defs/client-credentials',\n },\n authorizationCode: {\n $ref: '#/$defs/oauth-flows/$defs/authorization-code',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n implicit: {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n password: {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'client-credentials': {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'authorization-code': {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n },\n },\n 'security-requirement': {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n 'specification-extensions': {\n patternProperties: {\n '^x-': true,\n },\n },\n examples: {\n properties: {\n example: true,\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n },\n },\n 'map-of-strings': {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n};\n\nconst OAS_SCHEMAS = {\n '2.0': OAS_2,\n '3.0': OAS_3,\n 3.1: OAS_3_1,\n};\n\nfunction shouldIgnoreError(error) {\n return (\n // oneOf is a fairly error as we have 2 options to choose from for most of the time.\n error.keyword === 'oneOf' ||\n // the required $ref is entirely useless, since oas-schema rules operate on resolved content, so there won't be any $refs in the document\n (error.keyword === 'required' && error.params.missingProperty === '$ref')\n );\n}\n\n// this is supposed to cover edge cases we need to cover manually, when it's impossible to detect the most appropriate error, i.e. oneOf consisting of more than 3 members, etc.\n// note, more errors can be included if certain messages reported by AJV are not quite meaningful\nconst ERROR_MAP = [\n {\n path: /^components\\/securitySchemes\\/[^/]+$/,\n message: 'Invalid security scheme',\n },\n];\n\n// The function removes irrelevant (aka misleading, confusing, useless, whatever you call it) errors.\n// There are a few exceptions, i.e. security components I covered manually,\n// yet apart from them we usually deal with a relatively simple scenario that can be literally expressed as: \"either proper value of $ref property\".\n// The $ref part is never going to be interesting for us, because both oas-schema rules operate on resolved content, so we won't have any $refs left.\n// As you can see, what we deal here wit is actually not really oneOf anymore - it's always the first member of oneOf we match against.\n// That being said, we always strip both oneOf and $ref, since we are always interested in the first error.\nexport function prepareResults(errors) {\n // Update additionalProperties errors to make them more precise and prevent them from being treated as duplicates\n for (const error of errors) {\n if (error.keyword === 'additionalProperties') {\n error.instancePath = `${error.instancePath}/${String(error.params['additionalProperty'])}`;\n }\n }\n\n for (let i = 0; i < errors.length; i++) {\n const error = errors[i];\n\n if (i + 1 < errors.length && errors[i + 1].instancePath === error.instancePath) {\n errors.splice(i + 1, 1);\n i--;\n } else if (i > 0 && shouldIgnoreError(error) && errors[i - 1].instancePath.startsWith(error.instancePath)) {\n errors.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction applyManualReplacements(errors) {\n for (const error of errors) {\n if (error.path === void 0) continue;\n\n const joinedPath = error.path.join('/');\n\n for (const mappedError of ERROR_MAP) {\n if (mappedError.path.test(joinedPath)) {\n error.message = mappedError.message;\n break;\n }\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: null,\n },\n function oasDocumentSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n if (formats === null || formats === void 0) return;\n\n const schema = formats.has(oas2)\n ? OAS_SCHEMAS['2.0']\n : formats.has(oas3_1)\n ? OAS_SCHEMAS['3.1']\n : OAS_SCHEMAS['3.0'];\n\n const errors = schemaFn(targetVal, { allErrors: true, schema, prepareResults }, context);\n\n if (Array.isArray(errors)) {\n applyManualReplacements(errors);\n }\n\n return errors;\n },\n);\n", - "schema": "" + "content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { oas2, oas3_1 } from '@stoplight/spectral-formats';\n\nconst OAS_2 = {\n title: 'A JSON Schema for Swagger 2.0 API.',\n $id: 'http://swagger.io/v2/schema.json#',\n $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'object',\n required: ['swagger', 'info', 'paths'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n swagger: {\n type: 'string',\n enum: ['2.0'],\n description: 'The Swagger version of this document.',\n },\n info: {\n $ref: '#/definitions/info',\n },\n host: {\n type: 'string',\n pattern: '^[^{}/ :\\\\\\\\]+(?::\\\\d+)?$',\n description: \"The host (name or ip) of the API. Example: 'swagger.io'\",\n },\n basePath: {\n type: 'string',\n pattern: '^/',\n description: \"The base path to the API. Example: '/api'.\",\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n consumes: {\n description: 'A list of MIME types accepted by the API.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n paths: {\n $ref: '#/definitions/paths',\n },\n definitions: {\n $ref: '#/definitions/definitions',\n },\n parameters: {\n $ref: '#/definitions/parameterDefinitions',\n },\n responses: {\n $ref: '#/definitions/responseDefinitions',\n },\n security: {\n $ref: '#/definitions/security',\n },\n securityDefinitions: {\n $ref: '#/definitions/securityDefinitions',\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/tag',\n },\n uniqueItems: true,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n definitions: {\n info: {\n type: 'object',\n description: 'General information about the API.',\n required: ['version', 'title'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n title: {\n type: 'string',\n description: 'A unique and precise title of the API.',\n },\n version: {\n type: 'string',\n description: 'A semantic version number of the API.',\n },\n description: {\n type: 'string',\n description:\n 'A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.',\n },\n termsOfService: {\n type: 'string',\n description: 'The terms of service for the API.',\n },\n contact: {\n $ref: '#/definitions/contact',\n },\n license: {\n $ref: '#/definitions/license',\n },\n },\n },\n contact: {\n type: 'object',\n description: 'Contact information for the owners of the API.',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: 'The identifying name of the contact person/organization.',\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the contact information.',\n format: 'uri',\n },\n email: {\n type: 'string',\n description: 'The email address of the contact person/organization.',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n license: {\n type: 'object',\n required: ['name'],\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: \"The name of the license type. It's encouraged to use an OSI compatible license.\",\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the license.',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n paths: {\n type: 'object',\n description: \"Relative paths to the individual endpoints. They must be relative to the 'basePath'.\",\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n '^/': {\n $ref: '#/definitions/pathItem',\n },\n },\n additionalProperties: false,\n },\n definitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n description: 'One or more JSON objects describing the schemas being consumed and produced by the API.',\n },\n parameterDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/parameter',\n },\n description: 'One or more JSON representations for parameters',\n },\n responseDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/response',\n },\n description: 'One or more JSON representations for responses',\n },\n externalDocs: {\n type: 'object',\n additionalProperties: false,\n description: 'information about external documentation',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n examples: {\n type: 'object',\n additionalProperties: true,\n },\n mimeType: {\n type: 'string',\n description: 'The MIME type of the HTTP message.',\n },\n operation: {\n type: 'object',\n required: ['responses'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n summary: {\n type: 'string',\n description: 'A brief summary of the operation.',\n },\n description: {\n type: 'string',\n description: 'A longer description of the operation, GitHub Flavored Markdown is allowed.',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n operationId: {\n type: 'string',\n description: 'A unique identifier of the operation.',\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n consumes: {\n description: 'A list of MIME types the API can consume.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n responses: {\n $ref: '#/definitions/responses',\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n $ref: '#/definitions/security',\n },\n },\n },\n pathItem: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n get: {\n $ref: '#/definitions/operation',\n },\n put: {\n $ref: '#/definitions/operation',\n },\n post: {\n $ref: '#/definitions/operation',\n },\n delete: {\n $ref: '#/definitions/operation',\n },\n options: {\n $ref: '#/definitions/operation',\n },\n head: {\n $ref: '#/definitions/operation',\n },\n patch: {\n $ref: '#/definitions/operation',\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n },\n },\n responses: {\n type: 'object',\n description: \"Response objects names can either be any valid HTTP status code or 'default'.\",\n minProperties: 1,\n additionalProperties: false,\n patternProperties: {\n '^([0-9]{3})$|^(default)$': {\n $ref: '#/definitions/responseValue',\n },\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n not: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n },\n responseValue: {\n oneOf: [\n {\n $ref: '#/definitions/response',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n $ref: '#/definitions/fileSchema',\n },\n ],\n },\n headers: {\n $ref: '#/definitions/headers',\n },\n examples: {\n $ref: '#/definitions/examples',\n },\n },\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/header',\n },\n },\n header: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n vendorExtension: {\n description: 'Any property starting with x- is valid.',\n additionalProperties: true,\n additionalItems: true,\n },\n bodyParameter: {\n type: 'object',\n required: ['name', 'in', 'schema'],\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['body'],\n },\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n schema: {\n $ref: '#/definitions/schema',\n },\n },\n additionalProperties: false,\n },\n headerParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['header'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n queryParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['query'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n formDataParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['formData'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array', 'file'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n pathParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['required'],\n properties: {\n required: {\n type: 'boolean',\n enum: [true],\n description: 'Determines whether or not this parameter is required or optional.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['path'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n nonBodyParameter: {\n type: 'object',\n required: ['name', 'in', 'type'],\n oneOf: [\n {\n $ref: '#/definitions/headerParameterSubSchema',\n },\n {\n $ref: '#/definitions/formDataParameterSubSchema',\n },\n {\n $ref: '#/definitions/queryParameterSubSchema',\n },\n {\n $ref: '#/definitions/pathParameterSubSchema',\n },\n ],\n },\n parameter: {\n oneOf: [\n {\n $ref: '#/definitions/bodyParameter',\n },\n {\n $ref: '#/definitions/nonBodyParameter',\n },\n ],\n },\n schema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/multipleOf',\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n maxProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n additionalProperties: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'boolean',\n },\n ],\n default: {},\n },\n type: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/type',\n },\n items: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n ],\n default: {},\n },\n allOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n oneOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n anyOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n properties: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n default: {},\n },\n discriminator: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/xml',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n fileSchema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['type'],\n properties: {\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n type: {\n type: 'string',\n enum: ['file'],\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n primitivesItems: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/securityRequirement',\n },\n uniqueItems: true,\n },\n securityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n },\n xml: {\n type: 'object',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n tag: {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n securityDefinitions: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/basicAuthenticationSecurity',\n },\n {\n $ref: '#/definitions/apiKeySecurity',\n },\n {\n $ref: '#/definitions/oauth2ImplicitSecurity',\n },\n {\n $ref: '#/definitions/oauth2PasswordSecurity',\n },\n {\n $ref: '#/definitions/oauth2ApplicationSecurity',\n },\n {\n $ref: '#/definitions/oauth2AccessCodeSecurity',\n },\n ],\n },\n errorMessage: {\n properties: {\n basic: 'Invalid basic authentication security definition',\n apiKey: 'Invalid apiKey authentication security definition',\n oauth2: 'Invalid oauth2 authentication security definition',\n },\n _: 'Invalid security securityDefinitions',\n },\n },\n basicAuthenticationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['basic'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n apiKeySecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ImplicitSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['implicit'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2PasswordSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['password'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ApplicationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['application'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2AccessCodeSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['accessCode'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2Scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n mediaTypeList: {\n type: 'array',\n items: {\n $ref: '#/definitions/mimeType',\n },\n uniqueItems: true,\n },\n parametersList: {\n type: 'array',\n description: 'The parameters needed to send a valid API call.',\n additionalItems: false,\n items: {\n oneOf: [\n {\n $ref: '#/definitions/parameter',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n uniqueItems: true,\n },\n schemesList: {\n type: 'array',\n description: 'The transfer protocol of the API.',\n items: {\n type: 'string',\n enum: ['http', 'https', 'ws', 'wss'],\n },\n uniqueItems: true,\n },\n collectionFormat: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes'],\n default: 'csv',\n },\n collectionFormatWithMulti: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes', 'multi'],\n default: 'csv',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n jsonReference: {\n type: 'object',\n required: ['$ref'],\n additionalProperties: false,\n properties: {\n $ref: {\n type: 'string',\n },\n },\n },\n },\n};\n\nconst OAS_3 = {\n $id: 'https://spec.openapis.org/oas/3.0/schema/2019-04-02',\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Validation schema for OpenAPI Specification 3.0.X.',\n type: 'object',\n required: ['openapi', 'info', 'paths'],\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.0\\\\.\\\\d(-.+)?$',\n },\n info: {\n $ref: '#/definitions/Info',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/Tag',\n },\n uniqueItems: true,\n },\n paths: {\n $ref: '#/definitions/Paths',\n },\n components: {\n $ref: '#/definitions/Components',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n definitions: {\n Reference: {\n type: 'object',\n required: ['$ref'],\n patternProperties: {\n '^\\\\$ref$': {\n type: 'string',\n format: 'uri-reference',\n },\n },\n },\n Info: {\n type: 'object',\n required: ['title', 'version'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n format: 'uri-reference',\n },\n contact: {\n $ref: '#/definitions/Contact',\n },\n license: {\n $ref: '#/definitions/License',\n },\n version: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n email: {\n type: 'string',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n License: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Server: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/ServerVariable',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ServerVariable: {\n type: 'object',\n required: ['default'],\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n responses: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Response',\n },\n ],\n },\n },\n },\n parameters: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Parameter',\n },\n ],\n },\n },\n },\n examples: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Example',\n },\n ],\n },\n },\n },\n requestBodies: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/RequestBody',\n },\n ],\n },\n },\n },\n headers: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Header',\n },\n ],\n },\n },\n },\n securitySchemes: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/SecurityScheme',\n },\n ],\n },\n },\n },\n links: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Link',\n },\n ],\n },\n },\n },\n callbacks: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Callback',\n },\n ],\n },\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'boolean',\n default: false,\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'boolean',\n default: false,\n },\n maxLength: {\n type: 'integer',\n minimum: 0,\n },\n minLength: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n maxItems: {\n type: 'integer',\n minimum: 0,\n },\n minItems: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n maxProperties: {\n type: 'integer',\n minimum: 0,\n },\n minProperties: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n required: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n uniqueItems: true,\n },\n enum: {\n type: 'array',\n items: {},\n minItems: 1,\n uniqueItems: false,\n },\n type: {\n type: 'string',\n enum: ['array', 'boolean', 'integer', 'number', 'object', 'string'],\n },\n not: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n allOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n oneOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n anyOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n properties: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n {\n type: 'boolean',\n },\n ],\n default: true,\n },\n description: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n default: {},\n nullable: {\n type: 'boolean',\n default: false,\n },\n discriminator: {\n $ref: '#/definitions/Discriminator',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n writeOnly: {\n type: 'boolean',\n default: false,\n },\n example: {},\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/XML',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Discriminator: {\n type: 'object',\n required: ['propertyName'],\n properties: {\n propertyName: {\n type: 'string',\n },\n mapping: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n },\n XML: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n format: 'uri',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Header',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Link',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n MediaType: {\n type: 'object',\n properties: {\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Encoding',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n ],\n },\n Example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: {},\n externalValue: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n enum: ['simple'],\n default: 'simple',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n ],\n },\n Paths: {\n type: 'object',\n patternProperties: {\n '^\\\\/': {\n $ref: '#/definitions/PathItem',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n PathItem: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/definitions/Operation',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n Operation: {\n type: 'object',\n required: ['responses'],\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n requestBody: {\n oneOf: [\n {\n $ref: '#/definitions/RequestBody',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n responses: {\n $ref: '#/definitions/Responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Callback',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Responses: {\n type: 'object',\n properties: {\n default: {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n patternProperties: {\n '^[1-5](?:\\\\d{2}|XX)$': {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n '^x-': {},\n },\n minProperties: 1,\n additionalProperties: false,\n },\n SecurityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExternalDocumentation: {\n type: 'object',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExampleXORExamples: {\n description: 'Example and examples are mutually exclusive',\n not: {\n required: ['example', 'examples'],\n },\n },\n SchemaXORContent: {\n description: 'Schema and content are mutually exclusive, at least one is required',\n not: {\n required: ['schema', 'content'],\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n description: 'Some properties are not allowed if content is present',\n allOf: [\n {\n not: {\n required: ['style'],\n },\n },\n {\n not: {\n required: ['explode'],\n },\n },\n {\n not: {\n required: ['allowReserved'],\n },\n },\n {\n not: {\n required: ['example'],\n },\n },\n {\n not: {\n required: ['examples'],\n },\n },\n ],\n },\n ],\n },\n Parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n required: ['name', 'in'],\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n {\n $ref: '#/definitions/ParameterLocation',\n },\n ],\n },\n ParameterLocation: {\n description: 'Parameter location',\n oneOf: [\n {\n description: 'Parameter in path',\n required: ['required'],\n properties: {\n in: {\n enum: ['path'],\n },\n style: {\n enum: ['matrix', 'label', 'simple'],\n default: 'simple',\n },\n required: {\n enum: [true],\n },\n },\n },\n {\n description: 'Parameter in query',\n properties: {\n in: {\n enum: ['query'],\n },\n style: {\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n default: 'form',\n },\n },\n },\n {\n description: 'Parameter in header',\n properties: {\n in: {\n enum: ['header'],\n },\n style: {\n enum: ['simple'],\n default: 'simple',\n },\n },\n },\n {\n description: 'Parameter in cookie',\n properties: {\n in: {\n enum: ['cookie'],\n },\n style: {\n enum: ['form'],\n default: 'form',\n },\n },\n },\n ],\n },\n RequestBody: {\n type: 'object',\n required: ['content'],\n properties: {\n description: {\n type: 'string',\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n required: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n SecurityScheme: {\n oneOf: [\n {\n $ref: '#/definitions/APIKeySecurityScheme',\n },\n {\n $ref: '#/definitions/HTTPSecurityScheme',\n },\n {\n $ref: '#/definitions/OAuth2SecurityScheme',\n },\n {\n $ref: '#/definitions/OpenIdConnectSecurityScheme',\n },\n ],\n },\n APIKeySecurityScheme: {\n type: 'object',\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query', 'cookie'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n HTTPSecurityScheme: {\n type: 'object',\n required: ['scheme', 'type'],\n properties: {\n scheme: {\n type: 'string',\n },\n bearerFormat: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: ['http'],\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n oneOf: [\n {\n description: 'Bearer',\n properties: {\n scheme: {\n enum: ['bearer'],\n },\n },\n },\n {\n description: 'Non Bearer',\n not: {\n required: ['bearerFormat'],\n },\n properties: {\n scheme: {\n not: {\n enum: ['bearer'],\n },\n },\n },\n },\n ],\n },\n OAuth2SecurityScheme: {\n type: 'object',\n required: ['type', 'flows'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flows: {\n $ref: '#/definitions/OAuthFlows',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OpenIdConnectSecurityScheme: {\n type: 'object',\n required: ['type', 'openIdConnectUrl'],\n properties: {\n type: {\n type: 'string',\n enum: ['openIdConnect'],\n },\n openIdConnectUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OAuthFlows: {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/definitions/ImplicitOAuthFlow',\n },\n password: {\n $ref: '#/definitions/PasswordOAuthFlow',\n },\n clientCredentials: {\n $ref: '#/definitions/ClientCredentialsFlow',\n },\n authorizationCode: {\n $ref: '#/definitions/AuthorizationCodeOAuthFlow',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ImplicitOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n PasswordOAuthFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ClientCredentialsFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n AuthorizationCodeOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Link: {\n type: 'object',\n properties: {\n operationId: {\n type: 'string',\n },\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n parameters: {\n type: 'object',\n additionalProperties: {},\n },\n requestBody: {},\n description: {\n type: 'string',\n },\n server: {\n $ref: '#/definitions/Server',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n not: {\n description: 'Operation Id and Operation Ref are mutually exclusive',\n required: ['operationId', 'operationRef'],\n },\n },\n Callback: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/PathItem',\n },\n patternProperties: {\n '^x-': {},\n },\n },\n Encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Header',\n },\n },\n style: {\n type: 'string',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nconst OAS_3_1 = {\n $id: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28',\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.1\\\\.\\\\d+(-.+)?$',\n },\n info: {\n $ref: '#/$defs/info',\n },\n jsonSchemaDialect: {\n type: 'string',\n format: 'uri',\n default: 'https://spec.openapis.org/oas/3.1/dialect/base',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n paths: {\n $ref: '#/$defs/paths',\n },\n webhooks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n components: {\n $ref: '#/$defs/components',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/$defs/tag',\n },\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['openapi', 'info'],\n anyOf: [\n {\n required: ['paths'],\n errorMessage: 'The document must have either \"paths\", \"webhooks\" or \"components\"',\n },\n {\n required: ['components'],\n },\n {\n required: ['webhooks'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n info: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n },\n contact: {\n $ref: '#/$defs/contact',\n },\n license: {\n $ref: '#/$defs/license',\n },\n version: {\n type: 'string',\n },\n },\n required: ['title', 'version'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n email: {\n type: 'string',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n license: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n identifier: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['name'],\n oneOf: [\n {\n required: ['identifier'],\n },\n {\n required: ['url'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n server: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n format: 'uri-template',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/server-variable',\n },\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'server-variable': {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n required: ['default'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/schema',\n },\n },\n responses: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n parameters: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n requestBodies: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/request-body-or-reference',\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n securitySchemes: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/security-scheme-or-reference',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n pathItems: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n },\n patternProperties: {\n '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$': {\n $comment:\n 'Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected',\n propertyNames: {\n pattern: '^[a-zA-Z0-9._-]+$',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n paths: {\n type: 'object',\n patternProperties: {\n '^/': {\n $ref: '#/$defs/path-item',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item': {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/$defs/operation',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/path-item',\n },\n },\n operation: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n requestBody: {\n $ref: '#/$defs/request-body-or-reference',\n },\n responses: {\n $ref: '#/$defs/responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'external-documentation': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'path', 'cookie'],\n },\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n allowEmptyValue: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n required: ['in'],\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/examples',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form',\n },\n ],\n $defs: {\n 'styles-for-path': {\n if: {\n properties: {\n in: {\n const: 'path',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n name: {\n pattern: '[^/#?]+$',\n },\n style: {\n default: 'simple',\n enum: ['matrix', 'label', 'simple'],\n },\n required: {\n const: true,\n },\n },\n required: ['required'],\n },\n },\n 'styles-for-header': {\n if: {\n properties: {\n in: {\n const: 'header',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n },\n },\n },\n 'styles-for-query': {\n if: {\n properties: {\n in: {\n const: 'query',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n },\n },\n },\n 'styles-for-cookie': {\n if: {\n properties: {\n in: {\n const: 'cookie',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n const: 'form',\n },\n },\n },\n },\n 'styles-for-form': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'parameter-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/parameter',\n },\n },\n 'request-body': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n content: {\n $ref: '#/$defs/content',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n },\n required: ['content'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'request-body-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/request-body',\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/media-type',\n },\n propertyNames: {\n format: 'media-range',\n },\n },\n 'media-type': {\n type: 'object',\n properties: {\n schema: {\n $ref: '#/$defs/schema',\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/encoding',\n },\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/examples',\n },\n ],\n unevaluatedProperties: false,\n },\n encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n format: 'media-range',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/encoding/$defs/explode-default',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'explode-default': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n responses: {\n type: 'object',\n properties: {\n default: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n patternProperties: {\n '^[1-5](?:[0-9]{2}|XX)$': {\n $ref: '#/$defs/response-or-reference',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n response: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n content: {\n $ref: '#/$defs/content',\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n },\n required: ['description'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'response-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/response',\n },\n },\n callbacks: {\n type: 'object',\n $ref: '#/$defs/specification-extensions',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n 'callbacks-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/callbacks',\n },\n },\n example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: true,\n externalValue: {\n type: 'string',\n format: 'uri',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'example-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/example',\n },\n },\n link: {\n type: 'object',\n properties: {\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n operationId: true,\n parameters: {\n $ref: '#/$defs/map-of-strings',\n },\n requestBody: true,\n description: {\n type: 'string',\n },\n body: {\n $ref: '#/$defs/server',\n },\n },\n oneOf: [\n {\n required: ['operationRef'],\n },\n {\n required: ['operationId'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'link-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/link',\n },\n },\n header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n explode: {\n default: false,\n type: 'boolean',\n },\n },\n $ref: '#/$defs/examples',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'header-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/header',\n },\n },\n tag: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['name'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n reference: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n unevaluatedProperties: false,\n },\n schema: {\n $dynamicAnchor: 'meta',\n type: ['object', 'boolean'],\n },\n 'security-scheme': {\n type: 'object',\n properties: {\n type: {\n enum: ['apiKey', 'http', 'mutualTLS', 'oauth2', 'openIdConnect'],\n },\n description: {\n type: 'string',\n },\n },\n required: ['type'],\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-apikey',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http-bearer',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oauth2',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oidc',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'type-apikey': {\n if: {\n properties: {\n type: {\n const: 'apiKey',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'cookie'],\n },\n },\n required: ['name', 'in'],\n },\n },\n 'type-http': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n scheme: {\n type: 'string',\n },\n },\n required: ['scheme'],\n },\n },\n 'type-http-bearer': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n scheme: {\n type: 'string',\n pattern: '^[Bb][Ee][Aa][Rr][Ee][Rr]$',\n },\n },\n required: ['type', 'scheme'],\n },\n then: {\n properties: {\n bearerFormat: {\n type: 'string',\n },\n },\n },\n },\n 'type-oauth2': {\n if: {\n properties: {\n type: {\n const: 'oauth2',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n flows: {\n $ref: '#/$defs/oauth-flows',\n },\n },\n required: ['flows'],\n },\n },\n 'type-oidc': {\n if: {\n properties: {\n type: {\n const: 'openIdConnect',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n openIdConnectUrl: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['openIdConnectUrl'],\n },\n },\n },\n },\n 'security-scheme-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/security-scheme',\n },\n },\n 'oauth-flows': {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/$defs/oauth-flows/$defs/implicit',\n },\n password: {\n $ref: '#/$defs/oauth-flows/$defs/password',\n },\n clientCredentials: {\n $ref: '#/$defs/oauth-flows/$defs/client-credentials',\n },\n authorizationCode: {\n $ref: '#/$defs/oauth-flows/$defs/authorization-code',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n implicit: {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n password: {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'client-credentials': {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'authorization-code': {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n },\n },\n 'security-requirement': {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n 'specification-extensions': {\n patternProperties: {\n '^x-': true,\n },\n },\n examples: {\n properties: {\n example: true,\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n },\n },\n 'map-of-strings': {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n};\n\nconst OAS_SCHEMAS = {\n '2.0': OAS_2,\n '3.0': OAS_3,\n 3.1: OAS_3_1,\n};\n\nfunction shouldIgnoreError(error) {\n return (\n // oneOf is a fairly error as we have 2 options to choose from for most of the time.\n error.keyword === 'oneOf' ||\n // the required $ref is entirely useless, since oas-schema rules operate on resolved content, so there won't be any $refs in the document\n (error.keyword === 'required' && error.params.missingProperty === '$ref')\n );\n}\n\n// this is supposed to cover edge cases we need to cover manually, when it's impossible to detect the most appropriate error, i.e. oneOf consisting of more than 3 members, etc.\n// note, more errors can be included if certain messages reported by AJV are not quite meaningful\nconst ERROR_MAP = [\n {\n path: /^components\\/securitySchemes\\/[^/]+$/,\n message: 'Invalid security scheme',\n },\n];\n\n// The function removes irrelevant (aka misleading, confusing, useless, whatever you call it) errors.\n// There are a few exceptions, i.e. security components I covered manually,\n// yet apart from them we usually deal with a relatively simple scenario that can be literally expressed as: \"either proper value of $ref property\".\n// The $ref part is never going to be interesting for us, because both oas-schema rules operate on resolved content, so we won't have any $refs left.\n// As you can see, what we deal here wit is actually not really oneOf anymore - it's always the first member of oneOf we match against.\n// That being said, we always strip both oneOf and $ref, since we are always interested in the first error.\nexport function prepareResults(errors) {\n // Update additionalProperties errors to make them more precise and prevent them from being treated as duplicates\n for (const error of errors) {\n if (error.keyword === 'additionalProperties') {\n error.instancePath = `${error.instancePath}/${String(error.params['additionalProperty'])}`;\n }\n }\n\n for (let i = 0; i < errors.length; i++) {\n const error = errors[i];\n\n if (i + 1 < errors.length && errors[i + 1].instancePath === error.instancePath) {\n errors.splice(i + 1, 1);\n i--;\n } else if (i > 0 && shouldIgnoreError(error) && errors[i - 1].instancePath.startsWith(error.instancePath)) {\n errors.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction applyManualReplacements(errors) {\n for (const error of errors) {\n if (error.path === void 0) continue;\n\n const joinedPath = error.path.join('/');\n\n for (const mappedError of ERROR_MAP) {\n if (mappedError.path.test(joinedPath)) {\n error.message = mappedError.message;\n break;\n }\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: null,\n },\n function oasDocumentSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n if (formats === null || formats === void 0) return;\n\n const schema = formats.has(oas2)\n ? OAS_SCHEMAS['2.0']\n : formats.has(oas3_1)\n ? OAS_SCHEMAS['3.1']\n : OAS_SCHEMAS['3.0'];\n\n const errors = schemaFn(targetVal, { allErrors: true, schema, prepareResults }, context);\n\n if (Array.isArray(errors)) {\n applyManualReplacements(errors);\n }\n\n return errors;\n },\n);\n" }, { "id": "oWnSsB6ESXiPxcECo6sxv", "extendedFrom": "", "name": "oasDiscriminator", - "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport const oasDiscriminator = (schema, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. The discriminator property name is defined at this schema.\n * 2. The discriminator property is in the required property list.\n */\n\n if (!isObject(schema)) return;\n\n if (typeof schema.discriminator !== 'string') return;\n\n const discriminatorName = schema.discriminator;\n\n const results = [];\n\n if (!isObject(schema.properties) || !Object.keys(schema.properties).some(k => k === discriminatorName)) {\n results.push({\n message: `The discriminator property must be defined in this schema.`,\n path: [...path, 'properties'],\n });\n }\n\n if (!Array.isArray(schema.required) || !schema.required.some(n => n === discriminatorName)) {\n results.push({\n message: `The discriminator property must be in the required property list.`,\n path: [...path, 'required'],\n });\n }\n\n return results;\n};\n\nexport default oasDiscriminator;\n", - "schema": "" + "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport const oasDiscriminator = (schema, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. The discriminator property name is defined at this schema.\n * 2. The discriminator property is in the required property list.\n */\n\n if (!isObject(schema)) return;\n\n if (typeof schema.discriminator !== 'string') return;\n\n const discriminatorName = schema.discriminator;\n\n const results = [];\n\n if (!isObject(schema.properties) || !Object.keys(schema.properties).some(k => k === discriminatorName)) {\n results.push({\n message: `The discriminator property must be defined in this schema.`,\n path: [...path, 'properties'],\n });\n }\n\n if (!Array.isArray(schema.required) || !schema.required.some(n => n === discriminatorName)) {\n results.push({\n message: `The discriminator property must be in the required property list.`,\n path: [...path, 'required'],\n });\n }\n\n return results;\n};\n\nexport default oasDiscriminator;\n" }, { "id": "yV8GE2M3oZxmdMy_bselm", "extendedFrom": "", "name": "oasExample", - "content": "import { isPlainObject, pointerToPath } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport traverse from 'json-schema-traverse';\n\nconst MEDIA_VALIDATION_ITEMS = {\n 2: [\n {\n field: 'examples',\n multiple: true,\n keyed: false,\n },\n ],\n 3: [\n {\n field: 'example',\n multiple: false,\n keyed: false,\n },\n {\n field: 'examples',\n multiple: true,\n keyed: true,\n },\n ],\n};\n\nconst SCHEMA_VALIDATION_ITEMS = {\n 2: ['example', 'x-example', 'default'],\n 3: ['example', 'default'],\n};\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n\nconst oasSchema = createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nfunction* getMediaValidationItems(items, targetVal, givenPath, oasVersion) {\n for (const { field, keyed, multiple } of items) {\n if (!(field in targetVal)) {\n continue;\n }\n\n const value = targetVal[field];\n\n if (multiple) {\n if (!isObject(value)) continue;\n\n for (const exampleKey of Object.keys(value)) {\n const exampleValue = value[exampleKey];\n if (oasVersion === 3 && keyed && (!isObject(exampleValue) || 'externalValue' in exampleValue)) {\n // should be covered by oas3-examples-value-or-externalValue\n continue;\n }\n\n const targetPath = [...givenPath, field, exampleKey];\n\n if (keyed) {\n targetPath.push('value');\n }\n\n yield {\n value: keyed && isObject(exampleValue) ? exampleValue.value : exampleValue,\n path: targetPath,\n };\n }\n\n return;\n } else {\n return yield {\n value,\n path: [...givenPath, field],\n };\n }\n }\n}\n\nfunction* getSchemaValidationItems(fields, targetVal, givenPath) {\n for (const field of fields) {\n if (!(field in targetVal)) {\n continue;\n }\n\n yield {\n value: targetVal[field],\n path: [...givenPath, field],\n };\n }\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: {\n type: 'object',\n properties: {\n oasVersion: {\n enum: ['2', '3'],\n },\n schemaField: {\n type: 'string',\n },\n type: {\n enum: ['media', 'schema'],\n },\n },\n additionalProperties: false,\n },\n },\n function oasExample(targetVal, opts, context) {\n const formats = context.document.formats;\n const schemaOpts = {\n schema: opts.schemaField === '$' ? targetVal : targetVal[opts.schemaField],\n };\n\n let results = void 0;\n let oasVersion = parseInt(opts.oasVersion);\n\n const validationItems =\n opts.type === 'schema'\n ? getSchemaValidationItems(SCHEMA_VALIDATION_ITEMS[oasVersion], targetVal, context.path)\n : getMediaValidationItems(MEDIA_VALIDATION_ITEMS[oasVersion], targetVal, context.path, oasVersion);\n\n if (formats?.has(oas2) && 'required' in schemaOpts.schema && typeof schemaOpts.schema.required === 'boolean') {\n schemaOpts.schema = { ...schemaOpts.schema };\n delete schemaOpts.schema.required;\n }\n\n for (const validationItem of validationItems) {\n const result = oasSchema(validationItem.value, schemaOpts, {\n ...context,\n path: validationItem.path,\n });\n\n if (Array.isArray(result)) {\n if (results === void 0) results = [];\n results.push(...result);\n }\n }\n\n return results;\n },\n);\n", - "schema": "{\n \"type\": \"object\",\n \"properties\": {\n \"oasVersion\": {\n \"type\": \"string\",\n \"enum\": [\n \"2\",\n \"3\"\n ]\n },\n \"schemaField\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"media\",\n \"schema\"\n ]\n }\n }\n}" + "content": "import { isPlainObject, pointerToPath } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport traverse from 'json-schema-traverse';\n\nconst MEDIA_VALIDATION_ITEMS = {\n 2: [\n {\n field: 'examples',\n multiple: true,\n keyed: false,\n },\n ],\n 3: [\n {\n field: 'example',\n multiple: false,\n keyed: false,\n },\n {\n field: 'examples',\n multiple: true,\n keyed: true,\n },\n ],\n};\n\nconst SCHEMA_VALIDATION_ITEMS = {\n 2: ['example', 'x-example', 'default'],\n 3: ['example', 'default'],\n};\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n\nconst oasSchema = createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nfunction* getMediaValidationItems(items, targetVal, givenPath, oasVersion) {\n for (const { field, keyed, multiple } of items) {\n if (!(field in targetVal)) {\n continue;\n }\n\n const value = targetVal[field];\n\n if (multiple) {\n if (!isObject(value)) continue;\n\n for (const exampleKey of Object.keys(value)) {\n const exampleValue = value[exampleKey];\n if (oasVersion === 3 && keyed && (!isObject(exampleValue) || 'externalValue' in exampleValue)) {\n // should be covered by oas3-examples-value-or-externalValue\n continue;\n }\n\n const targetPath = [...givenPath, field, exampleKey];\n\n if (keyed) {\n targetPath.push('value');\n }\n\n yield {\n value: keyed && isObject(exampleValue) ? exampleValue.value : exampleValue,\n path: targetPath,\n };\n }\n\n return;\n } else {\n return yield {\n value,\n path: [...givenPath, field],\n };\n }\n }\n}\n\nfunction* getSchemaValidationItems(fields, targetVal, givenPath) {\n for (const field of fields) {\n if (!(field in targetVal)) {\n continue;\n }\n\n yield {\n value: targetVal[field],\n path: [...givenPath, field],\n };\n }\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: {\n type: 'object',\n properties: {\n oasVersion: {\n enum: ['2', '3'],\n },\n schemaField: {\n type: 'string',\n },\n type: {\n enum: ['media', 'schema'],\n },\n },\n additionalProperties: false,\n },\n },\n function oasExample(targetVal, opts, context) {\n const formats = context.document.formats;\n const schemaOpts = {\n schema: opts.schemaField === '$' ? targetVal : targetVal[opts.schemaField],\n };\n\n let results = void 0;\n let oasVersion = parseInt(opts.oasVersion);\n\n const validationItems =\n opts.type === 'schema'\n ? getSchemaValidationItems(SCHEMA_VALIDATION_ITEMS[oasVersion], targetVal, context.path)\n : getMediaValidationItems(MEDIA_VALIDATION_ITEMS[oasVersion], targetVal, context.path, oasVersion);\n\n if (formats?.has(oas2) && 'required' in schemaOpts.schema && typeof schemaOpts.schema.required === 'boolean') {\n schemaOpts.schema = { ...schemaOpts.schema };\n delete schemaOpts.schema.required;\n }\n\n for (const validationItem of validationItems) {\n const result = oasSchema(validationItem.value, schemaOpts, {\n ...context,\n path: validationItem.path,\n });\n\n if (Array.isArray(result)) {\n if (results === void 0) results = [];\n results.push(...result);\n }\n }\n\n return results;\n },\n);\n" }, { "id": "7IM2dxxl58nqnDNos_xti", "extendedFrom": "", "name": "oasOpFormDataConsumeCheck", - "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validConsumeValue = /(application\\/x-www-form-urlencoded|multipart\\/form-data)/;\n\nexport const oasOpFormDataConsumeCheck = targetVal => {\n if (!isObject(targetVal)) return;\n\n const parameters = targetVal.parameters;\n const consumes = targetVal.consumes;\n\n if (!Array.isArray(parameters) || !Array.isArray(consumes)) {\n return;\n }\n\n if (parameters.some(p => isObject(p) && p.in === 'formData') && !validConsumeValue.test(consumes?.join(','))) {\n return [\n {\n message: 'Consumes must include urlencoded, multipart, or form-data media type when using formData parameter.',\n },\n ];\n }\n\n return;\n};\n\nexport default oasOpFormDataConsumeCheck;\n", - "schema": "" + "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validConsumeValue = /(application\\/x-www-form-urlencoded|multipart\\/form-data)/;\n\nexport const oasOpFormDataConsumeCheck = targetVal => {\n if (!isObject(targetVal)) return;\n\n const parameters = targetVal.parameters;\n const consumes = targetVal.consumes;\n\n if (!Array.isArray(parameters) || !Array.isArray(consumes)) {\n return;\n }\n\n if (parameters.some(p => isObject(p) && p.in === 'formData') && !validConsumeValue.test(consumes?.join(','))) {\n return [\n {\n message: 'Consumes must include urlencoded, multipart, or form-data media type when using formData parameter.',\n },\n ];\n }\n\n return;\n};\n\nexport default oasOpFormDataConsumeCheck;\n" }, { "id": "qyreBtJPioj3lxIja57-4", "extendedFrom": "", "name": "oasOpIdUnique", - "content": "import { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasOpIdUnique = targetVal => {\n if (!isObject(targetVal) || !isObject(targetVal.paths)) return;\n\n const results = [];\n\n const { paths } = targetVal;\n\n const seenIds = [];\n\n for (const { path, operation } of getAllOperations(paths)) {\n const pathValue = paths[path];\n\n if (!isObject(pathValue)) continue;\n\n const operationValue = pathValue[operation];\n\n if (!isObject(operationValue) || !('operationId' in operationValue)) {\n continue;\n }\n\n const { operationId } = operationValue;\n\n if (seenIds.includes(operationId)) {\n results.push({\n message: 'operationId must be unique.',\n path: ['paths', path, operation, 'operationId'],\n });\n } else {\n seenIds.push(operationId);\n }\n }\n\n return results;\n};\n\nexport default oasOpIdUnique;\n", - "schema": "" + "content": "import { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasOpIdUnique = targetVal => {\n if (!isObject(targetVal) || !isObject(targetVal.paths)) return;\n\n const results = [];\n\n const { paths } = targetVal;\n\n const seenIds = [];\n\n for (const { path, operation } of getAllOperations(paths)) {\n const pathValue = paths[path];\n\n if (!isObject(pathValue)) continue;\n\n const operationValue = pathValue[operation];\n\n if (!isObject(operationValue) || !('operationId' in operationValue)) {\n continue;\n }\n\n const { operationId } = operationValue;\n\n if (seenIds.includes(operationId)) {\n results.push({\n message: 'operationId must be unique.',\n path: ['paths', path, operation, 'operationId'],\n });\n } else {\n seenIds.push(operationId);\n }\n }\n\n return results;\n};\n\nexport default oasOpIdUnique;\n" }, { "id": "eBZfmdV9f3yJhywGGfP6i", "extendedFrom": "", "name": "oasOpParams", - "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction computeFingerprint(param) {\n return `${String(param.in)}-${String(param.name)}`;\n}\n\nexport const oasOpParams = (params, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. Operations must have unique `name` + `in` parameters.\n * 2. Operation cannot have both `in:body` and `in:formData` parameters\n * 3. Operation must have only one `in:body` parameter.\n */\n\n if (!Array.isArray(params)) return;\n\n if (params.length < 2) return;\n\n const results = [];\n\n const count = {\n body: [],\n formData: [],\n };\n const list = [];\n const duplicates = [];\n\n let index = -1;\n\n for (const param of params) {\n index++;\n\n if (!isObject(param)) continue;\n\n // skip params that are refs\n if ('$ref' in param) continue;\n\n // Operations must have unique `name` + `in` parameters.\n const fingerprint = computeFingerprint(param);\n if (list.includes(fingerprint)) {\n duplicates.push(index);\n } else {\n list.push(fingerprint);\n }\n\n if (typeof param.in === 'string' && param.in in count) {\n count[param.in].push(index);\n }\n }\n\n if (duplicates.length > 0) {\n for (const i of duplicates) {\n results.push({\n message: 'A parameter in this operation already exposes the same combination of \"name\" and \"in\" values.',\n path: [...path, i],\n });\n }\n }\n\n if (count.body.length > 0 && count.formData.length > 0) {\n results.push({\n message: 'Operation must not have both \"in:body\" and \"in:formData\" parameters.',\n });\n }\n\n if (count.body.length > 1) {\n for (let i = 1; i < count.body.length; i++) {\n results.push({\n message: 'Operation must not have more than a single instance of the \"in:body\" parameter.',\n path: [...path, count.body[i]],\n });\n }\n }\n\n return results;\n};\n\nexport default oasOpParams;\n", - "schema": "" + "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction computeFingerprint(param) {\n return `${String(param.in)}-${String(param.name)}`;\n}\n\nexport const oasOpParams = (params, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. Operations must have unique `name` + `in` parameters.\n * 2. Operation cannot have both `in:body` and `in:formData` parameters\n * 3. Operation must have only one `in:body` parameter.\n */\n\n if (!Array.isArray(params)) return;\n\n if (params.length < 2) return;\n\n const results = [];\n\n const count = {\n body: [],\n formData: [],\n };\n const list = [];\n const duplicates = [];\n\n let index = -1;\n\n for (const param of params) {\n index++;\n\n if (!isObject(param)) continue;\n\n // skip params that are refs\n if ('$ref' in param) continue;\n\n // Operations must have unique `name` + `in` parameters.\n const fingerprint = computeFingerprint(param);\n if (list.includes(fingerprint)) {\n duplicates.push(index);\n } else {\n list.push(fingerprint);\n }\n\n if (typeof param.in === 'string' && param.in in count) {\n count[param.in].push(index);\n }\n }\n\n if (duplicates.length > 0) {\n for (const i of duplicates) {\n results.push({\n message: 'A parameter in this operation already exposes the same combination of \"name\" and \"in\" values.',\n path: [...path, i],\n });\n }\n }\n\n if (count.body.length > 0 && count.formData.length > 0) {\n results.push({\n message: 'Operation must not have both \"in:body\" and \"in:formData\" parameters.',\n });\n }\n\n if (count.body.length > 1) {\n for (let i = 1; i < count.body.length; i++) {\n results.push({\n message: 'Operation must not have more than a single instance of the \"in:body\" parameter.',\n path: [...path, count.body[i]],\n });\n }\n }\n\n return results;\n};\n\nexport default oasOpParams;\n" }, { "id": "M8I-IiA48R9_GpRVLR2-D", "extendedFrom": "", "name": "oasOpSecurityDefined", - "content": "import { isPlainObject } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nfunction _get(value, path) {\n for (const segment of path) {\n if (!isObject(value)) {\n break;\n }\n\n value = value[segment];\n }\n\n return value;\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n paths: {\n type: 'object',\n },\n security: {\n type: 'array',\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n schemesPath: {\n type: 'array',\n items: {\n type: ['string', 'number'],\n },\n },\n },\n },\n },\n function oasOpSecurityDefined(targetVal, { schemesPath }) {\n const { paths } = targetVal;\n\n const results = [];\n\n const schemes = _get(targetVal, schemesPath);\n const allDefs = isObject(schemes) ? Object.keys(schemes) : [];\n\n // Check global security requirements\n\n const { security } = targetVal;\n\n if (Array.isArray(security)) {\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `API \"security\" values must match a scheme defined in the \"${schemesPath.join('.')}\" object.`,\n path: ['security', index, securityKey],\n });\n }\n }\n }\n }\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { security } = value;\n\n if (!Array.isArray(security)) {\n continue;\n }\n\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `Operation \"security\" values must match a scheme defined in the \"${schemesPath.join(\n '.',\n )}\" object.`,\n path: ['paths', path, operation, 'security', index, securityKey],\n });\n }\n }\n }\n }\n\n return results;\n },\n);\n", - "schema": "{\n \"type\": \"object\",\n \"properties\": {\n \"schemesPath\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": [\n \"string\",\n \"number\"\n ]\n }\n }\n }\n}" + "content": "import { isPlainObject } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nfunction _get(value, path) {\n for (const segment of path) {\n if (!isObject(value)) {\n break;\n }\n\n value = value[segment];\n }\n\n return value;\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n paths: {\n type: 'object',\n },\n security: {\n type: 'array',\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n schemesPath: {\n type: 'array',\n items: {\n type: ['string', 'number'],\n },\n },\n },\n },\n },\n function oasOpSecurityDefined(targetVal, { schemesPath }) {\n const { paths } = targetVal;\n\n const results = [];\n\n const schemes = _get(targetVal, schemesPath);\n const allDefs = isObject(schemes) ? Object.keys(schemes) : [];\n\n // Check global security requirements\n\n const { security } = targetVal;\n\n if (Array.isArray(security)) {\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `API \"security\" values must match a scheme defined in the \"${schemesPath.join('.')}\" object.`,\n path: ['security', index, securityKey],\n });\n }\n }\n }\n }\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { security } = value;\n\n if (!Array.isArray(security)) {\n continue;\n }\n\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `Operation \"security\" values must match a scheme defined in the \"${schemesPath.join(\n '.',\n )}\" object.`,\n path: ['paths', path, operation, 'security', index, securityKey],\n });\n }\n }\n }\n }\n\n return results;\n },\n);\n" }, { "id": "UZ4xjIYz5GYPDsvg8OcM8", "extendedFrom": "", "name": "oasOpSuccessResponse", - "content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas3 } from '@stoplight/spectral-formats';\n\nexport const oasOpSuccessResponse = createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: null,\n },\n (input, opts, context) => {\n const isOAS3X = context.document.formats?.has(oas3) === true;\n\n for (const response of Object.keys(input)) {\n if (isOAS3X && (response === '2XX' || response === '3XX')) {\n return;\n }\n\n if (Number(response) >= 200 && Number(response) < 400) {\n return;\n }\n }\n\n return [\n {\n message: 'Operation must define at least a single 2xx or 3xx response',\n },\n ];\n },\n);\n\nexport default oasOpSuccessResponse;\n", - "schema": "" + "content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas3 } from '@stoplight/spectral-formats';\n\nexport const oasOpSuccessResponse = createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: null,\n },\n (input, opts, context) => {\n const isOAS3X = context.document.formats?.has(oas3) === true;\n\n for (const response of Object.keys(input)) {\n if (isOAS3X && (response === '2XX' || response === '3XX')) {\n return;\n }\n\n if (Number(response) >= 200 && Number(response) < 400) {\n return;\n }\n }\n\n return [\n {\n message: 'Operation must define at least a single 2xx or 3xx response',\n },\n ];\n },\n);\n\nexport default oasOpSuccessResponse;\n" }, { "id": "p5iMKUsFH7_JgSeDnWdXt", "extendedFrom": "", "name": "oasPathParam", - "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst pathRegex = /(\\{;?\\??[a-zA-Z0-9_-]+\\*?\\})/g;\n\nconst isNamedPathParam = p => {\n return p.in !== void 0 && p.in === 'path' && p.name !== void 0;\n};\n\nconst isUnknownNamedPathParam = (p, path, results, seen) => {\n if (!isNamedPathParam(p)) {\n return false;\n }\n\n if (p.required !== true) {\n results.push(generateResult(requiredMessage(p.name), path));\n }\n\n if (p.name in seen) {\n results.push(generateResult(uniqueDefinitionMessage(p.name), path));\n return false;\n }\n\n return true;\n};\n\nconst ensureAllDefinedPathParamsAreUsedInPath = (path, params, expected, results) => {\n for (const p of Object.keys(params)) {\n if (!params[p]) {\n continue;\n }\n\n if (!expected.includes(p)) {\n const resPath = params[p];\n results.push(generateResult(`Parameter \"${p}\" must be used in path \"${path}\".`, resPath));\n }\n }\n};\n\nconst ensureAllExpectedParamsInPathAreDefined = (path, params, expected, operationPath, results) => {\n for (const p of expected) {\n if (!(p in params)) {\n results.push(\n generateResult(`Operation must define parameter \"{${p}}\" as expected by path \"${path}\".`, operationPath),\n );\n }\n }\n};\n\nexport const oasPathParam = targetVal => {\n /**\n * This rule verifies:\n *\n * 1. for every param referenced in the path string ie /users/{userId}, var must be defined in either\n * path.parameters, or operation.parameters object\n * 2. every path.parameters + operation.parameters property must be used in the path string\n */\n\n if (!isObject(targetVal) || !isObject(targetVal.paths)) {\n return;\n }\n\n const results = [];\n\n // keep track of normalized paths for verifying paths are unique\n const uniquePaths = {};\n const validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\n for (const path of Object.keys(targetVal.paths)) {\n const pathValue = targetVal.paths[path];\n if (!isObject(pathValue)) continue;\n\n // verify normalized paths are functionally unique (ie `/path/{one}` vs `/path/{two}` are\n // different but equivalent within the context of OAS)\n const normalized = path.replace(pathRegex, '%'); // '%' is used here since its invalid in paths\n if (normalized in uniquePaths) {\n results.push(\n generateResult(`Paths \"${String(uniquePaths[normalized])}\" and \"${path}\" must not be equivalent.`, [\n 'paths',\n path,\n ]),\n );\n } else {\n uniquePaths[normalized] = path;\n }\n\n // find all templated path parameters\n const pathElements = [];\n let match;\n\n while ((match = pathRegex.exec(path))) {\n const p = match[0].replace(/[{}?*;]/g, '');\n if (pathElements.includes(p)) {\n results.push(generateResult(`Path \"${path}\" must not use parameter \"{${p}}\" multiple times.`, ['paths', path]));\n } else {\n pathElements.push(p);\n }\n }\n\n // find parameters set within the top-level 'parameters' object\n const topParams = {};\n if (Array.isArray(pathValue.parameters)) {\n for (const [i, value] of pathValue.parameters.entries()) {\n if (!isObject(value)) continue;\n\n const fullParameterPath = ['paths', path, 'parameters', i];\n\n if (isUnknownNamedPathParam(value, fullParameterPath, results, topParams)) {\n topParams[value.name] = fullParameterPath;\n }\n }\n }\n\n if (isObject(targetVal.paths[path])) {\n // find parameters set within the operation's 'parameters' object\n for (const op of Object.keys(pathValue)) {\n const operationValue = pathValue[op];\n if (!isObject(operationValue)) continue;\n\n if (op === 'parameters' || !validOperationKeys.includes(op)) {\n continue;\n }\n\n const operationParams = {};\n const { parameters } = operationValue;\n const operationPath = ['paths', path, op];\n\n if (Array.isArray(parameters)) {\n for (const [i, p] of parameters.entries()) {\n if (!isObject(p)) continue;\n\n const fullParameterPath = [...operationPath, 'parameters', i];\n\n if (isUnknownNamedPathParam(p, fullParameterPath, results, operationParams)) {\n operationParams[p.name] = fullParameterPath;\n }\n }\n }\n\n const definedParams = { ...topParams, ...operationParams };\n ensureAllDefinedPathParamsAreUsedInPath(path, definedParams, pathElements, results);\n ensureAllExpectedParamsInPathAreDefined(path, definedParams, pathElements, operationPath, results);\n }\n }\n }\n\n return results;\n};\n\nfunction generateResult(message, path) {\n return {\n message,\n path,\n };\n}\n\nconst requiredMessage = name => `Path parameter \"${name}\" must have \"required\" property that is set to \"true\".`;\n\nconst uniqueDefinitionMessage = name => `Path parameter \"${name}\" must not be defined multiple times.`;\n\nexport default oasPathParam;\n", - "schema": "" + "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst pathRegex = /(\\{;?\\??[a-zA-Z0-9_-]+\\*?\\})/g;\n\nconst isNamedPathParam = p => {\n return p.in !== void 0 && p.in === 'path' && p.name !== void 0;\n};\n\nconst isUnknownNamedPathParam = (p, path, results, seen) => {\n if (!isNamedPathParam(p)) {\n return false;\n }\n\n if (p.required !== true) {\n results.push(generateResult(requiredMessage(p.name), path));\n }\n\n if (p.name in seen) {\n results.push(generateResult(uniqueDefinitionMessage(p.name), path));\n return false;\n }\n\n return true;\n};\n\nconst ensureAllDefinedPathParamsAreUsedInPath = (path, params, expected, results) => {\n for (const p of Object.keys(params)) {\n if (!params[p]) {\n continue;\n }\n\n if (!expected.includes(p)) {\n const resPath = params[p];\n results.push(generateResult(`Parameter \"${p}\" must be used in path \"${path}\".`, resPath));\n }\n }\n};\n\nconst ensureAllExpectedParamsInPathAreDefined = (path, params, expected, operationPath, results) => {\n for (const p of expected) {\n if (!(p in params)) {\n results.push(\n generateResult(`Operation must define parameter \"{${p}}\" as expected by path \"${path}\".`, operationPath),\n );\n }\n }\n};\n\nexport const oasPathParam = targetVal => {\n /**\n * This rule verifies:\n *\n * 1. for every param referenced in the path string ie /users/{userId}, var must be defined in either\n * path.parameters, or operation.parameters object\n * 2. every path.parameters + operation.parameters property must be used in the path string\n */\n\n if (!isObject(targetVal) || !isObject(targetVal.paths)) {\n return;\n }\n\n const results = [];\n\n // keep track of normalized paths for verifying paths are unique\n const uniquePaths = {};\n const validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\n for (const path of Object.keys(targetVal.paths)) {\n const pathValue = targetVal.paths[path];\n if (!isObject(pathValue)) continue;\n\n // verify normalized paths are functionally unique (ie `/path/{one}` vs `/path/{two}` are\n // different but equivalent within the context of OAS)\n const normalized = path.replace(pathRegex, '%'); // '%' is used here since its invalid in paths\n if (normalized in uniquePaths) {\n results.push(\n generateResult(`Paths \"${String(uniquePaths[normalized])}\" and \"${path}\" must not be equivalent.`, [\n 'paths',\n path,\n ]),\n );\n } else {\n uniquePaths[normalized] = path;\n }\n\n // find all templated path parameters\n const pathElements = [];\n let match;\n\n while ((match = pathRegex.exec(path))) {\n const p = match[0].replace(/[{}?*;]/g, '');\n if (pathElements.includes(p)) {\n results.push(generateResult(`Path \"${path}\" must not use parameter \"{${p}}\" multiple times.`, ['paths', path]));\n } else {\n pathElements.push(p);\n }\n }\n\n // find parameters set within the top-level 'parameters' object\n const topParams = {};\n if (Array.isArray(pathValue.parameters)) {\n for (const [i, value] of pathValue.parameters.entries()) {\n if (!isObject(value)) continue;\n\n const fullParameterPath = ['paths', path, 'parameters', i];\n\n if (isUnknownNamedPathParam(value, fullParameterPath, results, topParams)) {\n topParams[value.name] = fullParameterPath;\n }\n }\n }\n\n if (isObject(targetVal.paths[path])) {\n // find parameters set within the operation's 'parameters' object\n for (const op of Object.keys(pathValue)) {\n const operationValue = pathValue[op];\n if (!isObject(operationValue)) continue;\n\n if (op === 'parameters' || !validOperationKeys.includes(op)) {\n continue;\n }\n\n const operationParams = {};\n const { parameters } = operationValue;\n const operationPath = ['paths', path, op];\n\n if (Array.isArray(parameters)) {\n for (const [i, p] of parameters.entries()) {\n if (!isObject(p)) continue;\n\n const fullParameterPath = [...operationPath, 'parameters', i];\n\n if (isUnknownNamedPathParam(p, fullParameterPath, results, operationParams)) {\n operationParams[p.name] = fullParameterPath;\n }\n }\n }\n\n const definedParams = { ...topParams, ...operationParams };\n ensureAllDefinedPathParamsAreUsedInPath(path, definedParams, pathElements, results);\n ensureAllExpectedParamsInPathAreDefined(path, definedParams, pathElements, operationPath, results);\n }\n }\n }\n\n return results;\n};\n\nfunction generateResult(message, path) {\n return {\n message,\n path,\n };\n}\n\nconst requiredMessage = name => `Path parameter \"${name}\" must have \"required\" property that is set to \"true\".`;\n\nconst uniqueDefinitionMessage = name => `Path parameter \"${name}\" must not be defined multiple times.`;\n\nexport default oasPathParam;\n" }, { "id": "jSPbiQ4Np9h0tZTAVxshi", "extendedFrom": "", "name": "oasSchema", - "content": "import traverse from 'json-schema-traverse';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { isPlainObject, pointerToPath } from '@stoplight/json';\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n", - "schema": "{\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"schema\": {\n \"type\": \"object\"\n }\n }\n}" + "content": "import traverse from 'json-schema-traverse';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { isPlainObject, pointerToPath } from '@stoplight/json';\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n" }, { "id": "zkdTymCWqcmxPJWZxyMxr", "extendedFrom": "", "name": "oasTagDefined", - "content": "// This function will check an API doc to verify that any tag that appears on\n// an operation is also present in the global tags array.\nimport { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasTagDefined = targetVal => {\n if (!isObject(targetVal)) return;\n const results = [];\n\n const globalTags = [];\n\n if (Array.isArray(targetVal.tags)) {\n for (const tag of targetVal.tags) {\n if (isObject(tag) && typeof tag.name === 'string') {\n globalTags.push(tag.name);\n }\n }\n }\n\n const { paths } = targetVal;\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { tags } = value;\n\n if (!Array.isArray(tags)) {\n continue;\n }\n\n for (const [i, tag] of tags.entries()) {\n if (!globalTags.includes(tag)) {\n results.push({\n message: 'Operation tags must be defined in global tags.',\n path: ['paths', path, operation, 'tags', i],\n });\n }\n }\n }\n\n return results;\n};\n\nexport default oasTagDefined;\n", - "schema": "" + "content": "// This function will check an API doc to verify that any tag that appears on\n// an operation is also present in the global tags array.\nimport { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasTagDefined = targetVal => {\n if (!isObject(targetVal)) return;\n const results = [];\n\n const globalTags = [];\n\n if (Array.isArray(targetVal.tags)) {\n for (const tag of targetVal.tags) {\n if (isObject(tag) && typeof tag.name === 'string') {\n globalTags.push(tag.name);\n }\n }\n }\n\n const { paths } = targetVal;\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { tags } = value;\n\n if (!Array.isArray(tags)) {\n continue;\n }\n\n for (const [i, tag] of tags.entries()) {\n if (!globalTags.includes(tag)) {\n results.push({\n message: 'Operation tags must be defined in global tags.',\n path: ['paths', path, operation, 'tags', i],\n });\n }\n }\n }\n\n return results;\n};\n\nexport default oasTagDefined;\n" }, { "id": "bSNTJ6RVt78jw4E_B8RZx", "extendedFrom": "", "name": "oasUnusedComponent", - "content": "import { unreferencedReusableObject } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n components: {\n type: 'object',\n },\n },\n required: ['components'],\n },\n options: null,\n },\n function oasUnusedComponent(targetVal, opts, context) {\n const results = [];\n const componentTypes = [\n 'schemas',\n 'responses',\n 'parameters',\n 'examples',\n 'requestBodies',\n 'headers',\n 'links',\n 'callbacks',\n ];\n\n for (const type of componentTypes) {\n const value = targetVal.components[type];\n if (!isObject(value)) continue;\n\n const resultsForType = unreferencedReusableObject(\n value,\n { reusableObjectsLocation: `#/components/${type}` },\n context,\n );\n if (resultsForType !== void 0 && Array.isArray(resultsForType)) {\n results.push(...resultsForType);\n }\n }\n\n return results;\n },\n);\n", - "schema": "" + "content": "import { unreferencedReusableObject } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n components: {\n type: 'object',\n },\n },\n required: ['components'],\n },\n options: null,\n },\n function oasUnusedComponent(targetVal, opts, context) {\n const results = [];\n const componentTypes = [\n 'schemas',\n 'responses',\n 'parameters',\n 'examples',\n 'requestBodies',\n 'headers',\n 'links',\n 'callbacks',\n ];\n\n for (const type of componentTypes) {\n const value = targetVal.components[type];\n if (!isObject(value)) continue;\n\n const resultsForType = unreferencedReusableObject(\n value,\n { reusableObjectsLocation: `#/components/${type}` },\n context,\n );\n if (resultsForType !== void 0 && Array.isArray(resultsForType)) {\n results.push(...resultsForType);\n }\n }\n\n return results;\n },\n);\n" }, { "id": "-uVRn9J4Aa9vPBuXTKs3j", "extendedFrom": "", "name": "refSiblings", - "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction getParentValue(document, path) {\n if (path.length === 0) {\n return null;\n }\n\n let piece = document;\n\n for (let i = 0; i < path.length - 1; i += 1) {\n if (!isObject(piece)) {\n return null;\n }\n\n piece = piece[path[i]];\n }\n\n return piece;\n}\n\nconst refSiblings = (targetVal, opts, { document, path }) => {\n const value = getParentValue(document.data, path);\n\n if (!isObject(value)) {\n return;\n }\n\n const keys = Object.keys(value);\n if (keys.length === 1) {\n return;\n }\n\n const results = [];\n const actualObjPath = path.slice(0, -1);\n\n for (const key of keys) {\n if (key === '$ref') {\n continue;\n }\n results.push({\n message: '$ref must not be placed next to any other properties',\n path: [...actualObjPath, key],\n });\n }\n\n return results;\n};\n\nexport default refSiblings;\n", - "schema": "" + "content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction getParentValue(document, path) {\n if (path.length === 0) {\n return null;\n }\n\n let piece = document;\n\n for (let i = 0; i < path.length - 1; i += 1) {\n if (!isObject(piece)) {\n return null;\n }\n\n piece = piece[path[i]];\n }\n\n return piece;\n}\n\nconst refSiblings = (targetVal, opts, { document, path }) => {\n const value = getParentValue(document.data, path);\n\n if (!isObject(value)) {\n return;\n }\n\n const keys = Object.keys(value);\n if (keys.length === 1) {\n return;\n }\n\n const results = [];\n const actualObjPath = path.slice(0, -1);\n\n for (const key of keys) {\n if (key === '$ref') {\n continue;\n }\n results.push({\n message: '$ref must not be placed next to any other properties',\n path: [...actualObjPath, key],\n });\n }\n\n return results;\n};\n\nexport default refSiblings;\n" }, { "id": "JLGe8QHPvzG6Ov6FWmWFZ", "extendedFrom": "", "name": "typedEnum", - "content": "import { oas2, oas3_0 } from '@stoplight/spectral-formats';\nimport { printValue } from '@stoplight/spectral-runtime';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction getDataType(input, checkForInteger) {\n const type = typeof input;\n switch (type) {\n case 'string':\n case 'boolean':\n return type;\n case 'number':\n if (checkForInteger && Number.isInteger(input)) {\n return 'integer';\n }\n\n return 'number';\n case 'object':\n if (input === null) {\n return 'null';\n }\n\n return Array.isArray(input) ? 'array' : 'object';\n default:\n throw TypeError('Unknown input type');\n }\n}\n\nfunction getTypes(input, formats) {\n const { type } = input;\n\n if (\n (input.nullable === true && formats?.has(oas3_0) === true) ||\n (input['x-nullable'] === true && formats?.has(oas2) === true)\n ) {\n return Array.isArray(type) ? [...type, 'null'] : [type, 'null'];\n }\n\n return type;\n}\n\nexport const typedEnum = createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n },\n type: {\n oneOf: [\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n {\n type: 'string',\n },\n ],\n },\n },\n required: ['enum', 'type'],\n },\n options: null,\n },\n function (input, opts, context) {\n const { enum: enumValues } = input;\n const type = getTypes(input, context.document.formats);\n const checkForInteger = type === 'integer' || (Array.isArray(type) && type.includes('integer'));\n\n let results;\n\n enumValues.forEach((value, i) => {\n const valueType = getDataType(value, checkForInteger);\n\n if (valueType === type || (Array.isArray(type) && type.includes(valueType))) {\n return;\n }\n\n results ??= [];\n results.push({\n message: `Enum value ${printValue(enumValues[i])} must be \"${String(type)}\".`,\n path: [...context.path, 'enum', i],\n });\n });\n\n return results;\n },\n);\n\nexport default typedEnum;\n", - "schema": "" + "content": "import { oas2, oas3_0 } from '@stoplight/spectral-formats';\nimport { printValue } from '@stoplight/spectral-runtime';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction getDataType(input, checkForInteger) {\n const type = typeof input;\n switch (type) {\n case 'string':\n case 'boolean':\n return type;\n case 'number':\n if (checkForInteger && Number.isInteger(input)) {\n return 'integer';\n }\n\n return 'number';\n case 'object':\n if (input === null) {\n return 'null';\n }\n\n return Array.isArray(input) ? 'array' : 'object';\n default:\n throw TypeError('Unknown input type');\n }\n}\n\nfunction getTypes(input, formats) {\n const { type } = input;\n\n if (\n (input.nullable === true && formats?.has(oas3_0) === true) ||\n (input['x-nullable'] === true && formats?.has(oas2) === true)\n ) {\n return Array.isArray(type) ? [...type, 'null'] : [type, 'null'];\n }\n\n return type;\n}\n\nexport const typedEnum = createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n },\n type: {\n oneOf: [\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n {\n type: 'string',\n },\n ],\n },\n },\n required: ['enum', 'type'],\n },\n options: null,\n },\n function (input, opts, context) {\n const { enum: enumValues } = input;\n const type = getTypes(input, context.document.formats);\n const checkForInteger = type === 'integer' || (Array.isArray(type) && type.includes('integer'));\n\n let results;\n\n enumValues.forEach((value, i) => {\n const valueType = getDataType(value, checkForInteger);\n\n if (valueType === type || (Array.isArray(type) && type.includes(valueType))) {\n return;\n }\n\n results ??= [];\n results.push({\n message: `Enum value ${printValue(enumValues[i])} must be \"${String(type)}\".`,\n path: [...context.path, 'enum', i],\n });\n });\n\n return results;\n },\n);\n\nexport default typedEnum;\n" } ], "extendedDefault": false diff --git a/api.yml b/api.yml index d7c463e4..aaef636c 100644 --- a/api.yml +++ b/api.yml @@ -7,6 +7,7 @@ info: contact: email: jeremy@bigjungle.net name: Jeremy Poulter + url: https://github.com/jeremypoulter/ license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' @@ -79,34 +80,54 @@ paths: description: | The status endpoint can be called to post external data that should be updated by MQTT If MQTT is not an option, all external data needed can be updated from an HTTP POST request to /status endpoint. - - Accepted parameters: - { - "voltage": int, // live voltage in V - "shaper_live_pwr": int, // total household live power in W - "solar": int, // divert solar production in W - "grid_ie": int, // divert grid -import/+export in W - "battery_level": int, // vehicle soc in % - "battery_range": int, // vehicle range - "time_to_full_charge": int // vehicle charge ETA - } - responses: - '200': + '200': description: OK content: application/json: schema: - $ref: ./models/Status.yaml + type: object + properties: + voltage: + type: integer + description: live voltage in V + shaper_live_pwr: + type: integer + description: total household live power in W + solar: + type: integer + description: divert solar production in W + grid_ie: + type: integer + description: divert grid -import/+export in W + battery_level: + type: integer + description: vehicle soc in % + battery_range: + type: integer + description: vehicle range + time_to_full_charge: + type: integer + description: vehicle charge ETA + x-examples: + EVSE Status: + voltage: 220 + shaper_live_pwr: 3400 + solar: 3000 + grid_ie: 3000 + battery_level: 85 + battery_range: 230 + time_to_full_charge: 1590 examples: EVSE Status: - "voltage": 220 - "shaper_live_pwr": 3400 - "solar": 3000 - "grid_ie": 3000 - "battery_level": 85 - "battery_range": 230 - "time_to_full_charge" 1590 + value: + voltage: 220 + shaper_live_pwr: 3400 + solar: 3000 + grid_ie: 3000 + battery_level: 85 + battery_range: 230 + time_to_full_charge: 1590 tags: - Status /ws: @@ -124,7 +145,7 @@ paths: schema: $ref: ./models/Status.yaml '400': - descritpion: Error + description: Error tags: - Status /config: @@ -456,7 +477,6 @@ paths: properties: current_day: $ref: '#/components/schemas/Day' - operationId: getSchedulePlan tags: - Schedule @@ -578,6 +598,7 @@ components: - friday - saturday - sunday + x-examples: {} ScheduleEvent: type: object properties: diff --git a/models/Config.yaml b/models/Config.yaml index 34e42b89..7973757d 100644 --- a/models/Config.yaml +++ b/models/Config.yaml @@ -84,85 +84,6 @@ x-examples: ocpp_energize_plug: true mqtt_protocol: mqtt charge_mode: fast -examples: - - firmware: D7.1.2 - protocol: '-' - espflash: 4194304 - espinfo: ESP32r1 2 core WiFi BLE BT - buildenv: openevse_esp-wrover-kit - version: 4.1.0.dev - diode_check: true - gfci_check: true - ground_check: true - relay_check: true - vent_check: true - temp_check: true - service: 0 - scale: 220 - offset: 0 - max_current_soft: 32 - min_current_hard: 6 - max_current_hard: 32 - mqtt_supported_protocols: - - mqtt - - mqtts - http_supported_protocols: - - http - - https - ssid: wibble_ext - pass: _DUMMY_PASSWORD - www_username: '' - www_password: '' - hostname: openevse-a7d4 - sntp_hostname: pool.ntp.org - time_zone: 'Europe/London|GMT0BST,M3.5.0/1,M10.5.0' - emoncms_server: 'https://emoncms.org' - emoncms_node: openevse-a7d4 - emoncms_apikey: _DUMMY_PASSWORD - emoncms_fingerprint: '' - mqtt_server: homeassistant.lan - mqtt_port: 1883 - mqtt_topic: openevse - mqtt_retained: false - mqtt_user: emonpi - mqtt_pass: _DUMMY_PASSWORD - mqtt_solar: '' - mqtt_grid_ie: emon/test/grid_ie - mqtt_vrms: emon/rightbar/voltage - mqtt_vehicle_soc: '' - mqtt_vehicle_range: '' - mqtt_vehicle_eta: '' - mqtt_announce_topic: openevse/announce/a7d4 - ocpp_server: '' - ocpp_chargeBoxId: '' - ocpp_idTag: '' - tx_start_point: tx_pending - ohm: '' - divert_PV_ratio: 1.1 - divert_attack_smoothing_factor: 0.4 - divert_decay_smoothing_factor: 0.05 - divert_min_charge_time: 10 - tesla_access_token: _DUMMY_PASSWORD - tesla_refresh_token: _DUMMY_PASSWORD - tesla_created_at: 2479357952 - tesla_expires_in: 3888000 - tesla_vehicle_id: '142960157278' - led_brightness: 51 - flags: 115467 - emoncms_enabled: true - mqtt_enabled: true - mqtt_reject_unauthorized: true - ohm_enabled: false - sntp_enabled: true - tesla_enabled: true - divert_enabled: true - pause_uses_disabled: false - mqtt_vehicle_range_miles: false - ocpp_enabled: true - ocpp_suspend_evse: true - ocpp_energize_plug: true - mqtt_protocol: mqtt - charge_mode: fast x-tags: - Config properties: @@ -367,7 +288,5 @@ properties: scheduler_start_window: type: number default: 600 - description: > - The maximum number of seconds to randomly add/subtract from the a scheduled charge start time, - eg a value of 600 will adjust the start time my +/- 10 minutes. This is to help prevent large - syncrinised loads when multiple verchiles start charging at the same time. + description: | + The maximum number of seconds to randomly add/subtract from the a scheduled charge start time, eg a value of 600 will adjust the start time my +/- 10 minutes. This is to help prevent large syncrinised loads when multiple verchiles start charging at the same time. diff --git a/models/Properties.yaml b/models/Properties.yaml index d8962d16..e1faa2bb 100644 --- a/models/Properties.yaml +++ b/models/Properties.yaml @@ -3,7 +3,6 @@ type: object x-tags: - Claims description: '' -examples: [] properties: state: $ref: ./EvseState.yaml