@scalar/openapi-parser
Advanced tools
Comparing version 0.8.6 to 0.8.7
# @scalar/openapi-parser | ||
## 0.8.7 | ||
### Patch Changes | ||
- 6394a5d: chore: switch to @scalar/build-tooling | ||
## 0.8.6 | ||
@@ -4,0 +10,0 @@ |
@@ -1,1 +0,27 @@ | ||
import e from"../schemas/v2.0/schema.json.js";import s from"../schemas/v3.0/schema.json.js";import n from"../schemas/v3.1/schema.json.js";const o={"2.0":e,"3.0":s,3.1:n},r=Object.keys(o),t={EMPTY_OR_INVALID:"Can’t find JSON, YAML or filename in data",OPENAPI_VERSION_NOT_SUPPORTED:"Can’t find supported Swagger/OpenAPI version in specification, version must be a string.",INVALID_REFERENCE:"Can’t resolve reference: %s",EXTERNAL_REFERENCE_NOT_FOUND:"Can’t resolve external reference: %s",FILE_DOES_NOT_EXIST:"File does not exist: %s",NO_CONTENT:"No content found"};export{t as ERRORS,o as OpenApiSpecifications,r as OpenApiVersions}; | ||
import Swagger20 from '../schemas/v2.0/schema.json.js'; | ||
import OpenApi30 from '../schemas/v3.0/schema.json.js'; | ||
import OpenApi31 from '../schemas/v3.1/schema.json.js'; | ||
/** | ||
* A list of the supported OpenAPI specifications | ||
*/ | ||
const OpenApiSpecifications = { | ||
'2.0': Swagger20, | ||
'3.0': OpenApi30, | ||
'3.1': OpenApi31, | ||
}; | ||
const OpenApiVersions = Object.keys(OpenApiSpecifications); | ||
/** | ||
* List of error messages used in the Validator | ||
*/ | ||
const ERRORS = { | ||
EMPTY_OR_INVALID: 'Can’t find JSON, YAML or filename in data', | ||
// URI_MUST_BE_STRING: 'uri parameter or $id attribute must be a string', | ||
OPENAPI_VERSION_NOT_SUPPORTED: 'Can’t find supported Swagger/OpenAPI version in specification, version must be a string.', | ||
INVALID_REFERENCE: 'Can’t resolve reference: %s', | ||
EXTERNAL_REFERENCE_NOT_FOUND: 'Can’t resolve external reference: %s', | ||
FILE_DOES_NOT_EXIST: 'File does not exist: %s', | ||
NO_CONTENT: 'No content found', | ||
}; | ||
export { ERRORS, OpenApiSpecifications, OpenApiVersions }; |
@@ -1,1 +0,26 @@ | ||
export{ERRORS,OpenApiSpecifications,OpenApiVersions}from"./configuration/index.js";export{Validator,jsonSchemaVersions}from"./lib/Validator/Validator.js";export{resolveReferences}from"./utils/resolveReferences.js";export{dereference}from"./utils/dereference.js";export{details}from"./utils/details.js";export{escapeJsonPointer}from"./utils/escapeJsonPointer.js";export{filter}from"./utils/filter.js";export{getEntrypoint}from"./utils/getEntrypoint.js";export{getListOfReferences}from"./utils/getListOfReferences.js";export{getSegmentsFromPath}from"./utils/getSegmentsFromPath.js";export{isFilesystem}from"./utils/isFilesystem.js";export{isJson}from"./utils/isJson.js";export{isObject}from"./utils/isObject.js";export{isYaml}from"./utils/isYaml.js";export{load}from"./utils/load/load.js";export{normalize}from"./utils/normalize.js";export{openapi}from"./utils/openapi/openapi.js";export{toJson}from"./utils/toJson.js";export{toYaml}from"./utils/toYaml.js";export{transformErrors}from"./utils/transformErrors.js";export{traverse}from"./utils/traverse.js";export{unescapeJsonPointer}from"./utils/unescapeJsonPointer.js";export{upgrade}from"./utils/upgrade.js";export{isSchemaPath,upgradeFromThreeToThreeOne}from"./utils/upgradeFromThreeToThreeOne.js";export{upgradeFromTwoToThree}from"./utils/upgradeFromTwoToThree.js";export{validate}from"./utils/validate.js"; | ||
export { ERRORS, OpenApiSpecifications, OpenApiVersions } from './configuration/index.js'; | ||
export { Validator, jsonSchemaVersions } from './lib/Validator/Validator.js'; | ||
export { resolveReferences } from './utils/resolveReferences.js'; | ||
export { dereference } from './utils/dereference.js'; | ||
export { details } from './utils/details.js'; | ||
export { escapeJsonPointer } from './utils/escapeJsonPointer.js'; | ||
export { filter } from './utils/filter.js'; | ||
export { getEntrypoint } from './utils/getEntrypoint.js'; | ||
export { getListOfReferences } from './utils/getListOfReferences.js'; | ||
export { getSegmentsFromPath } from './utils/getSegmentsFromPath.js'; | ||
export { isFilesystem } from './utils/isFilesystem.js'; | ||
export { isJson } from './utils/isJson.js'; | ||
export { isObject } from './utils/isObject.js'; | ||
export { isYaml } from './utils/isYaml.js'; | ||
export { load } from './utils/load/load.js'; | ||
export { normalize } from './utils/normalize.js'; | ||
export { openapi } from './utils/openapi/openapi.js'; | ||
export { toJson } from './utils/toJson.js'; | ||
export { toYaml } from './utils/toYaml.js'; | ||
export { transformErrors } from './utils/transformErrors.js'; | ||
export { traverse } from './utils/traverse.js'; | ||
export { unescapeJsonPointer } from './utils/unescapeJsonPointer.js'; | ||
export { upgrade } from './utils/upgrade.js'; | ||
export { isSchemaPath, upgradeFromThreeToThreeOne } from './utils/upgradeFromThreeToThreeOne.js'; | ||
export { upgradeFromTwoToThree } from './utils/upgradeFromTwoToThree.js'; | ||
export { validate } from './utils/validate.js'; |
@@ -1,1 +0,127 @@ | ||
import r from"ajv-draft-04";import i from"ajv-formats";import o from"ajv/dist/2020.js";import{OpenApiVersions as s,ERRORS as t,OpenApiSpecifications as e}from"../../configuration/index.js";import{details as a}from"../../utils/details.js";import{resolveReferences as n}from"../../utils/resolveReferences.js";import{transformErrors as c}from"../../utils/transformErrors.js";const f={"http://json-schema.org/draft-04/schema#":r,"https://json-schema.org/draft/2020-12/schema":o};class h{version;static supportedVersions=s;ajvValidators={};errors;specificationVersion;specificationType;specification;async validate(r,i){const o=r.find((r=>r.isEntrypoint)),s=o?.specification;this.specification=s,this.specification?.info&&!this.specification.info.version&&(this.specification.info.version="0.0.1");try{if(null==s){if(i?.throwOnError)throw new Error(t.EMPTY_OR_INVALID);return{valid:!1,errors:c(o,t.EMPTY_OR_INVALID)}}const{version:e,specificationType:f,specificationVersion:h}=a(s);if(this.version=e,this.specificationVersion=h,this.specificationType=f,!e){if(i?.throwOnError)throw new Error(t.OPENAPI_VERSION_NOT_SUPPORTED);return{valid:!1,errors:c(o,t.OPENAPI_VERSION_NOT_SUPPORTED)}}const p=await this.getAjvValidator(e),m=p(s);if(p.errors&&p.errors.length>0){if(i?.throwOnError)throw new Error(p.errors[0]);return{valid:!1,errors:c(o,p.errors)}}const d=n(r,i);return{valid:m&&d.valid,errors:[...m.errors??[],...d.errors],schema:d.schema}}catch(r){if(i?.throwOnError)throw r;return{valid:!1,errors:c(o,r.message??r)}}}async getAjvValidator(r){if(this.ajvValidators[r])return this.ajvValidators[r];const o=e[r],s=new(0,f[o.$schema])({strict:!1});return i(s),"3.1"===r&&s.addFormat("media-range",!0),this.ajvValidators[r]=s.compile(o)}}export{h as Validator,f as jsonSchemaVersions}; | ||
import Ajv04 from 'ajv-draft-04'; | ||
import addFormats from 'ajv-formats'; | ||
import Ajv2020 from 'ajv/dist/2020.js'; | ||
import { OpenApiVersions, ERRORS, OpenApiSpecifications } from '../../configuration/index.js'; | ||
import { details } from '../../utils/details.js'; | ||
import { resolveReferences } from '../../utils/resolveReferences.js'; | ||
import { transformErrors } from '../../utils/transformErrors.js'; | ||
/** | ||
* Configure available JSON Schema versions | ||
*/ | ||
const jsonSchemaVersions = { | ||
'http://json-schema.org/draft-04/schema#': Ajv04, | ||
'https://json-schema.org/draft/2020-12/schema': Ajv2020, | ||
}; | ||
class Validator { | ||
version; | ||
static supportedVersions = OpenApiVersions; | ||
// Object with function *or* object { errors: string } | ||
ajvValidators = {}; | ||
errors; | ||
specificationVersion; | ||
specificationType; | ||
specification; | ||
/** | ||
* Checks whether a specification is valid and all references can be resolved. | ||
*/ | ||
async validate(filesystem, options) { | ||
const entrypoint = filesystem.find((file) => file.isEntrypoint); | ||
const specification = entrypoint?.specification; | ||
// TODO: How does this work with a filesystem? | ||
this.specification = specification; | ||
// TODO: defaulting info.version to keep parser compatible with the previous one | ||
// we should bubble this error up and not throw on it | ||
if (this.specification?.info && !this.specification.info.version) { | ||
this.specification.info.version = '0.0.1'; | ||
} | ||
try { | ||
// AnyObject is empty or invalid | ||
if (specification === undefined || specification === null) { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.EMPTY_OR_INVALID); | ||
} | ||
return { | ||
valid: false, | ||
errors: transformErrors(entrypoint, ERRORS.EMPTY_OR_INVALID), | ||
}; | ||
} | ||
// Meta data about the specification | ||
const { version, specificationType, specificationVersion } = details(specification); | ||
this.version = version; | ||
this.specificationVersion = specificationVersion; | ||
this.specificationType = specificationType; | ||
// AnyObject is not supported | ||
if (!version) { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.OPENAPI_VERSION_NOT_SUPPORTED); | ||
} | ||
return { | ||
valid: false, | ||
errors: transformErrors(entrypoint, ERRORS.OPENAPI_VERSION_NOT_SUPPORTED), | ||
}; | ||
} | ||
// Get the correct OpenAPI validator | ||
const validateSchema = await this.getAjvValidator(version); | ||
const schemaResult = validateSchema(specification); | ||
// Error handling | ||
if (validateSchema.errors) { | ||
if (validateSchema.errors.length > 0) { | ||
if (options?.throwOnError) { | ||
throw new Error(validateSchema.errors[0]); | ||
} | ||
return { | ||
valid: false, | ||
errors: transformErrors(entrypoint, validateSchema.errors), | ||
}; | ||
} | ||
} | ||
// Check if the references are valid | ||
const resolvedReferences = resolveReferences(filesystem, options); | ||
return { | ||
valid: schemaResult && resolvedReferences.valid, | ||
errors: [...(schemaResult.errors ?? []), ...resolvedReferences.errors], | ||
schema: resolvedReferences.schema, | ||
}; | ||
} | ||
catch (error) { | ||
// Something went horribly wrong! | ||
if (options?.throwOnError) { | ||
throw error; | ||
} | ||
return { | ||
valid: false, | ||
errors: transformErrors(entrypoint, error.message ?? error), | ||
}; | ||
} | ||
} | ||
/** | ||
* Ajv JSON schema validator | ||
*/ | ||
async getAjvValidator(version) { | ||
// Schema loaded already | ||
if (this.ajvValidators[version]) { | ||
return this.ajvValidators[version]; | ||
} | ||
// Load OpenAPI Schema | ||
const schema = OpenApiSpecifications[version]; | ||
// Load JSON Schema | ||
const AjvClass = jsonSchemaVersions[schema.$schema]; | ||
// Get the correct Ajv validator | ||
const ajv = new AjvClass({ | ||
// Ajv is a bit too strict in its strict validation of OpenAPI schemas. | ||
// Switch strict mode off. | ||
strict: false, | ||
}); | ||
// Register formats | ||
// https://ajv.js.org/packages/ajv-formats.html#formats | ||
addFormats(ajv); | ||
// OpenAPI 3.1 uses media-range format | ||
if (version === '3.1') { | ||
ajv.addFormat('media-range', true); | ||
} | ||
return (this.ajvValidators[version] = ajv.compile(schema)); | ||
} | ||
} | ||
export { Validator, jsonSchemaVersions }; |
@@ -1,1 +0,120 @@ | ||
const t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;function n(t){const n=r(t),e="/"===s(t,-1);return(t=function(t,n){let r=0;for(let n=t.length-1;n>=0;n--){const e=t[n];"."===e?t.splice(n,1):".."===e?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(n)for(;r--;r)t.unshift("..");return t}(o(t.split("/"),(function(t){return!!t})),!n).join("/"))||n||(t="."),t&&e&&(t+="/"),(n?"/":"")+t}function r(t){return"/"===t.charAt(0)}function e(...t){return n(o(t,(function(t,n){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))}function u(n){const r=(u=n,t.exec(u).slice(1)),e=r[0];var u;let o=r[1];return e||o?(o&&(o=o.substr(0,o.length-1)),e+o):"."}function o(t,n){if(t.filter)return t.filter(n);const r=[];for(let e=0;e<t.length;e++)n(t[e],e,t)&&r.push(t[e]);return r}const s="b"==="ab".substr(-1)?function(t,n,r){return t.substr(n,r)}:function(t,n,r){return n<0&&(n=t.length+n),t.substr(n,r)};export{u as dirname,r as isAbsolute,e as join,n as normalize}; | ||
// @ts-nocheck | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// resolves . and .. elements in a path array with directory names there | ||
// must be no slashes, empty elements, or device names (c:\) in the array | ||
// (so also no leading and trailing slashes - it does not distinguish | ||
// relative and absolute paths) | ||
function normalizeArray(parts, allowAboveRoot) { | ||
// if the path tries to go above the root, `up` ends up > 0 | ||
let up = 0; | ||
for (let i = parts.length - 1; i >= 0; i--) { | ||
const last = parts[i]; | ||
if (last === '.') { | ||
parts.splice(i, 1); | ||
} | ||
else if (last === '..') { | ||
parts.splice(i, 1); | ||
up++; | ||
} | ||
else if (up) { | ||
parts.splice(i, 1); | ||
up--; | ||
} | ||
} | ||
// if the path is allowed to go above the root, restore leading ..s | ||
if (allowAboveRoot) { | ||
for (; up--; up) { | ||
parts.unshift('..'); | ||
} | ||
} | ||
return parts; | ||
} | ||
// Split a filename into [root, dir, basename, ext], unix version | ||
// 'root' is just a slash, or nothing. | ||
const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/; | ||
const splitPath = function (filename) { | ||
return splitPathRe.exec(filename).slice(1); | ||
}; | ||
// path.normalize(path) | ||
// posix version | ||
function normalize(path) { | ||
const isPathAbsolute = isAbsolute(path), trailingSlash = substr(path, -1) === '/'; | ||
// Normalize the path | ||
path = normalizeArray(filter(path.split('/'), function (p) { | ||
return !!p; | ||
}), !isPathAbsolute).join('/'); | ||
if (!path && !isPathAbsolute) { | ||
path = '.'; | ||
} | ||
if (path && trailingSlash) { | ||
path += '/'; | ||
} | ||
return (isPathAbsolute ? '/' : '') + path; | ||
} | ||
// posix version | ||
function isAbsolute(path) { | ||
return path.charAt(0) === '/'; | ||
} | ||
// posix version | ||
function join(...paths) { | ||
return normalize(filter(paths, function (p, index) { | ||
if (typeof p !== 'string') { | ||
throw new TypeError('Arguments to path.join must be strings'); | ||
} | ||
return p; | ||
}).join('/')); | ||
} | ||
function dirname(path) { | ||
const result = splitPath(path), root = result[0]; | ||
let dir = result[1]; | ||
if (!root && !dir) { | ||
// No dirname whatsoever | ||
return '.'; | ||
} | ||
if (dir) { | ||
// It has a dirname, strip trailing slash | ||
dir = dir.substr(0, dir.length - 1); | ||
} | ||
return root + dir; | ||
} | ||
function filter(xs, f) { | ||
if (xs.filter) | ||
return xs.filter(f); | ||
const res = []; | ||
for (let i = 0; i < xs.length; i++) { | ||
if (f(xs[i], i, xs)) | ||
res.push(xs[i]); | ||
} | ||
return res; | ||
} | ||
// String.prototype.substr - negative index don't work in IE8 | ||
const substr = 'ab'.substr(-1) === 'b' | ||
? function (str, start, len) { | ||
return str.substr(start, len); | ||
} | ||
: function (str, start, len) { | ||
if (start < 0) | ||
start = str.length + start; | ||
return str.substr(start, len); | ||
}; | ||
export { dirname, isAbsolute, join, normalize }; |
@@ -1,1 +0,1623 @@ | ||
var e="A JSON Schema for Swagger 2.0 API.",i="http://swagger.io/v2/schema.json#",t="http://json-schema.org/draft-04/schema#",r="object",n=["swagger","info","paths"],o=!1,s={"^x-":{$ref:"#/definitions/vendorExtension"}},a={swagger:{type:"string",enum:["2.0"],description:"The Swagger version of this document."},info:{$ref:"#/definitions/info"},host:{type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",description:"The host (name or ip) of the API. Example: 'swagger.io'"},basePath:{type:"string",pattern:"^/",description:"The base path to the API. Example: '/api'."},schemes:{$ref:"#/definitions/schemesList"},consumes:{description:"A list of MIME types accepted by the API.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},produces:{description:"A list of MIME types the API can produce.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},paths:{$ref:"#/definitions/paths"},definitions:{$ref:"#/definitions/definitions"},parameters:{$ref:"#/definitions/parameterDefinitions"},responses:{$ref:"#/definitions/responseDefinitions"},security:{$ref:"#/definitions/security"},securityDefinitions:{$ref:"#/definitions/securityDefinitions"},tags:{type:"array",items:{$ref:"#/definitions/tag"},uniqueItems:!0},externalDocs:{$ref:"#/definitions/externalDocs"}},p={info:{type:"object",description:"General information about the API.",required:["version","title"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{title:{type:"string",description:"A unique and precise title of the API."},version:{type:"string",description:"A semantic version number of the API."},description:{type:"string",description:"A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."},termsOfService:{type:"string",description:"The terms of service for the API."},contact:{$ref:"#/definitions/contact"},license:{$ref:"#/definitions/license"}}},contact:{type:"object",description:"Contact information for the owners of the API.",additionalProperties:!1,properties:{name:{type:"string",description:"The identifying name of the contact person/organization."},url:{type:"string",description:"The URL pointing to the contact information.",format:"uri"},email:{type:"string",description:"The email address of the contact person/organization.",format:"email"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},license:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"The name of the license type. It's encouraged to use an OSI compatible license."},url:{type:"string",description:"The URL pointing to the license.",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},paths:{type:"object",description:"Relative paths to the individual endpoints. They must be relative to the 'basePath'.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"},"^/":{$ref:"#/definitions/pathItem"}},additionalProperties:!1},definitions:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},description:"One or more JSON objects describing the schemas being consumed and produced by the API."},parameterDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/parameter"},description:"One or more JSON representations for parameters"},responseDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/response"},description:"One or more JSON representations for responses"},externalDocs:{type:"object",additionalProperties:!1,description:"information about external documentation",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},examples:{type:"object",additionalProperties:!0},mimeType:{type:"string",description:"The MIME type of the HTTP message."},operation:{type:"object",required:["responses"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{tags:{type:"array",items:{type:"string"},uniqueItems:!0},summary:{type:"string",description:"A brief summary of the operation."},description:{type:"string",description:"A longer description of the operation, GitHub Flavored Markdown is allowed."},externalDocs:{$ref:"#/definitions/externalDocs"},operationId:{type:"string",description:"A unique identifier of the operation."},produces:{description:"A list of MIME types the API can produce.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},consumes:{description:"A list of MIME types the API can consume.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},parameters:{$ref:"#/definitions/parametersList"},responses:{$ref:"#/definitions/responses"},schemes:{$ref:"#/definitions/schemesList"},deprecated:{type:"boolean",default:!1},security:{$ref:"#/definitions/security"}}},pathItem:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},get:{$ref:"#/definitions/operation"},put:{$ref:"#/definitions/operation"},post:{$ref:"#/definitions/operation"},delete:{$ref:"#/definitions/operation"},options:{$ref:"#/definitions/operation"},head:{$ref:"#/definitions/operation"},patch:{$ref:"#/definitions/operation"},parameters:{$ref:"#/definitions/parametersList"}}},responses:{type:"object",description:"Response objects names can either be any valid HTTP status code or 'default'.",minProperties:1,additionalProperties:!1,patternProperties:{"^([0-9]{3})$|^(default)$":{$ref:"#/definitions/responseValue"},"^x-":{$ref:"#/definitions/vendorExtension"}},not:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}}},responseValue:{oneOf:[{$ref:"#/definitions/response"},{$ref:"#/definitions/jsonReference"}]},response:{type:"object",required:["description"],properties:{description:{type:"string"},schema:{oneOf:[{$ref:"#/definitions/schema"},{$ref:"#/definitions/fileSchema"}]},headers:{$ref:"#/definitions/headers"},examples:{$ref:"#/definitions/examples"}},additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},headers:{type:"object",additionalProperties:{$ref:"#/definitions/header"}},header:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},vendorExtension:{description:"Any property starting with x- is valid.",additionalProperties:!0,additionalItems:!0},bodyParameter:{type:"object",required:["name","in","schema"],patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},in:{type:"string",description:"Determines the location of the parameter.",enum:["body"]},required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},schema:{$ref:"#/definitions/schema"}},additionalProperties:!1},headerParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["header"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},queryParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["query"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},formDataParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["formData"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array","file"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},pathParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["required"],properties:{required:{type:"boolean",enum:[!0],description:"Determines whether or not this parameter is required or optional."},in:{type:"string",description:"Determines the location of the parameter.",enum:["path"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},nonBodyParameter:{type:"object",required:["name","in","type"],oneOf:[{$ref:"#/definitions/headerParameterSubSchema"},{$ref:"#/definitions/formDataParameterSubSchema"},{$ref:"#/definitions/queryParameterSubSchema"},{$ref:"#/definitions/pathParameterSubSchema"}]},parameter:{oneOf:[{$ref:"#/definitions/bodyParameter"},{$ref:"#/definitions/nonBodyParameter"}]},schema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},maxProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},additionalProperties:{anyOf:[{$ref:"#/definitions/schema"},{type:"boolean"}],default:{}},type:{$ref:"http://json-schema.org/draft-04/schema#/properties/type"},items:{anyOf:[{$ref:"#/definitions/schema"},{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}}],default:{}},allOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},properties:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},default:{}},discriminator:{type:"string"},readOnly:{type:"boolean",default:!1},xml:{$ref:"#/definitions/xml"},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},fileSchema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["type"],properties:{format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},type:{type:"string",enum:["file"]},readOnly:{type:"boolean",default:!1},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},primitivesItems:{type:"object",additionalProperties:!1,properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},security:{type:"array",items:{$ref:"#/definitions/securityRequirement"},uniqueItems:!0},securityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"},uniqueItems:!0}},xml:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},tag:{type:"object",additionalProperties:!1,required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/externalDocs"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},securityDefinitions:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuthenticationSecurity"},{$ref:"#/definitions/apiKeySecurity"},{$ref:"#/definitions/oauth2ImplicitSecurity"},{$ref:"#/definitions/oauth2PasswordSecurity"},{$ref:"#/definitions/oauth2ApplicationSecurity"},{$ref:"#/definitions/oauth2AccessCodeSecurity"}]}},basicAuthenticationSecurity:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["basic"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},apiKeySecurity:{type:"object",additionalProperties:!1,required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ImplicitSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["implicit"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2PasswordSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["password"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ApplicationSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["application"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2AccessCodeSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["accessCode"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2Scopes:{type:"object",additionalProperties:{type:"string"}},mediaTypeList:{type:"array",items:{$ref:"#/definitions/mimeType"},uniqueItems:!0},parametersList:{type:"array",description:"The parameters needed to send a valid API call.",additionalItems:!1,items:{oneOf:[{$ref:"#/definitions/parameter"},{$ref:"#/definitions/jsonReference"}]},uniqueItems:!0},schemesList:{type:"array",description:"The transfer protocol of the API.",items:{type:"string",enum:["http","https","ws","wss"]},uniqueItems:!0},collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes"],default:"csv"},collectionFormatWithMulti:{type:"string",enum:["csv","ssv","tsv","pipes","multi"],default:"csv"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},jsonReference:{type:"object",required:["$ref"],additionalProperties:!1,properties:{$ref:{type:"string"}}}},m={title:e,id:i,$schema:t,type:r,required:n,additionalProperties:o,patternProperties:s,properties:a,definitions:p};export{t as $schema,o as additionalProperties,m as default,p as definitions,i as id,s as patternProperties,a as properties,n as required,e as title,r as type}; | ||
var title = "A JSON Schema for Swagger 2.0 API."; | ||
var id = "http://swagger.io/v2/schema.json#"; | ||
var $schema = "http://json-schema.org/draft-04/schema#"; | ||
var type = "object"; | ||
var required = [ | ||
"swagger", | ||
"info", | ||
"paths" | ||
]; | ||
var additionalProperties = false; | ||
var patternProperties = { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}; | ||
var properties = { | ||
swagger: { | ||
type: "string", | ||
"enum": [ | ||
"2.0" | ||
], | ||
description: "The Swagger version of this document." | ||
}, | ||
info: { | ||
$ref: "#/definitions/info" | ||
}, | ||
host: { | ||
type: "string", | ||
pattern: "^[^{}/ :\\\\]+(?::\\d+)?$", | ||
description: "The host (name or ip) of the API. Example: 'swagger.io'" | ||
}, | ||
basePath: { | ||
type: "string", | ||
pattern: "^/", | ||
description: "The base path to the API. Example: '/api'." | ||
}, | ||
schemes: { | ||
$ref: "#/definitions/schemesList" | ||
}, | ||
consumes: { | ||
description: "A list of MIME types accepted by the API.", | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/mediaTypeList" | ||
} | ||
] | ||
}, | ||
produces: { | ||
description: "A list of MIME types the API can produce.", | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/mediaTypeList" | ||
} | ||
] | ||
}, | ||
paths: { | ||
$ref: "#/definitions/paths" | ||
}, | ||
definitions: { | ||
$ref: "#/definitions/definitions" | ||
}, | ||
parameters: { | ||
$ref: "#/definitions/parameterDefinitions" | ||
}, | ||
responses: { | ||
$ref: "#/definitions/responseDefinitions" | ||
}, | ||
security: { | ||
$ref: "#/definitions/security" | ||
}, | ||
securityDefinitions: { | ||
$ref: "#/definitions/securityDefinitions" | ||
}, | ||
tags: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/tag" | ||
}, | ||
uniqueItems: true | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/externalDocs" | ||
} | ||
}; | ||
var definitions = { | ||
info: { | ||
type: "object", | ||
description: "General information about the API.", | ||
required: [ | ||
"version", | ||
"title" | ||
], | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
title: { | ||
type: "string", | ||
description: "A unique and precise title of the API." | ||
}, | ||
version: { | ||
type: "string", | ||
description: "A semantic version number of the API." | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." | ||
}, | ||
termsOfService: { | ||
type: "string", | ||
description: "The terms of service for the API." | ||
}, | ||
contact: { | ||
$ref: "#/definitions/contact" | ||
}, | ||
license: { | ||
$ref: "#/definitions/license" | ||
} | ||
} | ||
}, | ||
contact: { | ||
type: "object", | ||
description: "Contact information for the owners of the API.", | ||
additionalProperties: false, | ||
properties: { | ||
name: { | ||
type: "string", | ||
description: "The identifying name of the contact person/organization." | ||
}, | ||
url: { | ||
type: "string", | ||
description: "The URL pointing to the contact information.", | ||
format: "uri" | ||
}, | ||
email: { | ||
type: "string", | ||
description: "The email address of the contact person/organization.", | ||
format: "email" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
license: { | ||
type: "object", | ||
required: [ | ||
"name" | ||
], | ||
additionalProperties: false, | ||
properties: { | ||
name: { | ||
type: "string", | ||
description: "The name of the license type. It's encouraged to use an OSI compatible license." | ||
}, | ||
url: { | ||
type: "string", | ||
description: "The URL pointing to the license.", | ||
format: "uri" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
paths: { | ||
type: "object", | ||
description: "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
}, | ||
"^/": { | ||
$ref: "#/definitions/pathItem" | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
definitions: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/schema" | ||
}, | ||
description: "One or more JSON objects describing the schemas being consumed and produced by the API." | ||
}, | ||
parameterDefinitions: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/parameter" | ||
}, | ||
description: "One or more JSON representations for parameters" | ||
}, | ||
responseDefinitions: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/response" | ||
}, | ||
description: "One or more JSON representations for responses" | ||
}, | ||
externalDocs: { | ||
type: "object", | ||
additionalProperties: false, | ||
description: "information about external documentation", | ||
required: [ | ||
"url" | ||
], | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
examples: { | ||
type: "object", | ||
additionalProperties: true | ||
}, | ||
mimeType: { | ||
type: "string", | ||
description: "The MIME type of the HTTP message." | ||
}, | ||
operation: { | ||
type: "object", | ||
required: [ | ||
"responses" | ||
], | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
tags: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
}, | ||
uniqueItems: true | ||
}, | ||
summary: { | ||
type: "string", | ||
description: "A brief summary of the operation." | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A longer description of the operation, GitHub Flavored Markdown is allowed." | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/externalDocs" | ||
}, | ||
operationId: { | ||
type: "string", | ||
description: "A unique identifier of the operation." | ||
}, | ||
produces: { | ||
description: "A list of MIME types the API can produce.", | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/mediaTypeList" | ||
} | ||
] | ||
}, | ||
consumes: { | ||
description: "A list of MIME types the API can consume.", | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/mediaTypeList" | ||
} | ||
] | ||
}, | ||
parameters: { | ||
$ref: "#/definitions/parametersList" | ||
}, | ||
responses: { | ||
$ref: "#/definitions/responses" | ||
}, | ||
schemes: { | ||
$ref: "#/definitions/schemesList" | ||
}, | ||
deprecated: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
security: { | ||
$ref: "#/definitions/security" | ||
} | ||
} | ||
}, | ||
pathItem: { | ||
type: "object", | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
$ref: { | ||
type: "string" | ||
}, | ||
get: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
put: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
post: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
"delete": { | ||
$ref: "#/definitions/operation" | ||
}, | ||
options: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
head: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
patch: { | ||
$ref: "#/definitions/operation" | ||
}, | ||
parameters: { | ||
$ref: "#/definitions/parametersList" | ||
} | ||
} | ||
}, | ||
responses: { | ||
type: "object", | ||
description: "Response objects names can either be any valid HTTP status code or 'default'.", | ||
minProperties: 1, | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^([0-9]{3})$|^(default)$": { | ||
$ref: "#/definitions/responseValue" | ||
}, | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
not: { | ||
type: "object", | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
} | ||
}, | ||
responseValue: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/response" | ||
}, | ||
{ | ||
$ref: "#/definitions/jsonReference" | ||
} | ||
] | ||
}, | ||
response: { | ||
type: "object", | ||
required: [ | ||
"description" | ||
], | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
schema: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/fileSchema" | ||
} | ||
] | ||
}, | ||
headers: { | ||
$ref: "#/definitions/headers" | ||
}, | ||
examples: { | ||
$ref: "#/definitions/examples" | ||
} | ||
}, | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/header" | ||
} | ||
}, | ||
header: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"integer", | ||
"boolean", | ||
"array" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormat" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
vendorExtension: { | ||
description: "Any property starting with x- is valid.", | ||
additionalProperties: true, | ||
additionalItems: true | ||
}, | ||
bodyParameter: { | ||
type: "object", | ||
required: [ | ||
"name", | ||
"in", | ||
"schema" | ||
], | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
description: { | ||
type: "string", | ||
description: "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." | ||
}, | ||
name: { | ||
type: "string", | ||
description: "The name of the parameter." | ||
}, | ||
"in": { | ||
type: "string", | ||
description: "Determines the location of the parameter.", | ||
"enum": [ | ||
"body" | ||
] | ||
}, | ||
required: { | ||
type: "boolean", | ||
description: "Determines whether or not this parameter is required or optional.", | ||
"default": false | ||
}, | ||
schema: { | ||
$ref: "#/definitions/schema" | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
headerParameterSubSchema: { | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
required: { | ||
type: "boolean", | ||
description: "Determines whether or not this parameter is required or optional.", | ||
"default": false | ||
}, | ||
"in": { | ||
type: "string", | ||
description: "Determines the location of the parameter.", | ||
"enum": [ | ||
"header" | ||
] | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." | ||
}, | ||
name: { | ||
type: "string", | ||
description: "The name of the parameter." | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"boolean", | ||
"integer", | ||
"array" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormat" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
} | ||
} | ||
}, | ||
queryParameterSubSchema: { | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
required: { | ||
type: "boolean", | ||
description: "Determines whether or not this parameter is required or optional.", | ||
"default": false | ||
}, | ||
"in": { | ||
type: "string", | ||
description: "Determines the location of the parameter.", | ||
"enum": [ | ||
"query" | ||
] | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." | ||
}, | ||
name: { | ||
type: "string", | ||
description: "The name of the parameter." | ||
}, | ||
allowEmptyValue: { | ||
type: "boolean", | ||
"default": false, | ||
description: "allows sending a parameter by name only or with an empty value." | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"boolean", | ||
"integer", | ||
"array" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormatWithMulti" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
} | ||
} | ||
}, | ||
formDataParameterSubSchema: { | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
required: { | ||
type: "boolean", | ||
description: "Determines whether or not this parameter is required or optional.", | ||
"default": false | ||
}, | ||
"in": { | ||
type: "string", | ||
description: "Determines the location of the parameter.", | ||
"enum": [ | ||
"formData" | ||
] | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." | ||
}, | ||
name: { | ||
type: "string", | ||
description: "The name of the parameter." | ||
}, | ||
allowEmptyValue: { | ||
type: "boolean", | ||
"default": false, | ||
description: "allows sending a parameter by name only or with an empty value." | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"boolean", | ||
"integer", | ||
"array", | ||
"file" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormatWithMulti" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
} | ||
} | ||
}, | ||
pathParameterSubSchema: { | ||
additionalProperties: false, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
required: [ | ||
"required" | ||
], | ||
properties: { | ||
required: { | ||
type: "boolean", | ||
"enum": [ | ||
true | ||
], | ||
description: "Determines whether or not this parameter is required or optional." | ||
}, | ||
"in": { | ||
type: "string", | ||
description: "Determines the location of the parameter.", | ||
"enum": [ | ||
"path" | ||
] | ||
}, | ||
description: { | ||
type: "string", | ||
description: "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." | ||
}, | ||
name: { | ||
type: "string", | ||
description: "The name of the parameter." | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"boolean", | ||
"integer", | ||
"array" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormat" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
} | ||
} | ||
}, | ||
nonBodyParameter: { | ||
type: "object", | ||
required: [ | ||
"name", | ||
"in", | ||
"type" | ||
], | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/headerParameterSubSchema" | ||
}, | ||
{ | ||
$ref: "#/definitions/formDataParameterSubSchema" | ||
}, | ||
{ | ||
$ref: "#/definitions/queryParameterSubSchema" | ||
}, | ||
{ | ||
$ref: "#/definitions/pathParameterSubSchema" | ||
} | ||
] | ||
}, | ||
parameter: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/bodyParameter" | ||
}, | ||
{ | ||
$ref: "#/definitions/nonBodyParameter" | ||
} | ||
] | ||
}, | ||
schema: { | ||
type: "object", | ||
description: "A deterministic version of a JSON Schema object.", | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
properties: { | ||
$ref: { | ||
type: "string" | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
title: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/title" | ||
}, | ||
description: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/description" | ||
}, | ||
"default": { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/default" | ||
}, | ||
multipleOf: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/multipleOf" | ||
}, | ||
maximum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" | ||
}, | ||
minLength: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" | ||
}, | ||
pattern: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" | ||
}, | ||
minItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" | ||
}, | ||
uniqueItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/uniqueItems" | ||
}, | ||
maxProperties: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" | ||
}, | ||
minProperties: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" | ||
}, | ||
required: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/stringArray" | ||
}, | ||
"enum": { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/enum" | ||
}, | ||
additionalProperties: { | ||
anyOf: [ | ||
{ | ||
$ref: "#/definitions/schema" | ||
}, | ||
{ | ||
type: "boolean" | ||
} | ||
], | ||
"default": { | ||
} | ||
}, | ||
type: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/type" | ||
}, | ||
items: { | ||
anyOf: [ | ||
{ | ||
$ref: "#/definitions/schema" | ||
}, | ||
{ | ||
type: "array", | ||
minItems: 1, | ||
items: { | ||
$ref: "#/definitions/schema" | ||
} | ||
} | ||
], | ||
"default": { | ||
} | ||
}, | ||
allOf: { | ||
type: "array", | ||
minItems: 1, | ||
items: { | ||
$ref: "#/definitions/schema" | ||
} | ||
}, | ||
properties: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/schema" | ||
}, | ||
"default": { | ||
} | ||
}, | ||
discriminator: { | ||
type: "string" | ||
}, | ||
readOnly: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
xml: { | ||
$ref: "#/definitions/xml" | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/externalDocs" | ||
}, | ||
example: { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
fileSchema: { | ||
type: "object", | ||
description: "A deterministic version of a JSON Schema object.", | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
], | ||
properties: { | ||
format: { | ||
type: "string" | ||
}, | ||
title: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/title" | ||
}, | ||
description: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/description" | ||
}, | ||
"default": { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/default" | ||
}, | ||
required: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/stringArray" | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"file" | ||
] | ||
}, | ||
readOnly: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/externalDocs" | ||
}, | ||
example: { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
primitivesItems: { | ||
type: "object", | ||
additionalProperties: false, | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"integer", | ||
"boolean", | ||
"array" | ||
] | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
items: { | ||
$ref: "#/definitions/primitivesItems" | ||
}, | ||
collectionFormat: { | ||
$ref: "#/definitions/collectionFormat" | ||
}, | ||
"default": { | ||
$ref: "#/definitions/default" | ||
}, | ||
maximum: { | ||
$ref: "#/definitions/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "#/definitions/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "#/definitions/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "#/definitions/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "#/definitions/maxLength" | ||
}, | ||
minLength: { | ||
$ref: "#/definitions/minLength" | ||
}, | ||
pattern: { | ||
$ref: "#/definitions/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "#/definitions/maxItems" | ||
}, | ||
minItems: { | ||
$ref: "#/definitions/minItems" | ||
}, | ||
uniqueItems: { | ||
$ref: "#/definitions/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "#/definitions/enum" | ||
}, | ||
multipleOf: { | ||
$ref: "#/definitions/multipleOf" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
security: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/securityRequirement" | ||
}, | ||
uniqueItems: true | ||
}, | ||
securityRequirement: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
}, | ||
uniqueItems: true | ||
} | ||
}, | ||
xml: { | ||
type: "object", | ||
additionalProperties: false, | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
namespace: { | ||
type: "string" | ||
}, | ||
prefix: { | ||
type: "string" | ||
}, | ||
attribute: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
wrapped: { | ||
type: "boolean", | ||
"default": false | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
tag: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"name" | ||
], | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/externalDocs" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
securityDefinitions: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/basicAuthenticationSecurity" | ||
}, | ||
{ | ||
$ref: "#/definitions/apiKeySecurity" | ||
}, | ||
{ | ||
$ref: "#/definitions/oauth2ImplicitSecurity" | ||
}, | ||
{ | ||
$ref: "#/definitions/oauth2PasswordSecurity" | ||
}, | ||
{ | ||
$ref: "#/definitions/oauth2ApplicationSecurity" | ||
}, | ||
{ | ||
$ref: "#/definitions/oauth2AccessCodeSecurity" | ||
} | ||
] | ||
} | ||
}, | ||
basicAuthenticationSecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"basic" | ||
] | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
apiKeySecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type", | ||
"name", | ||
"in" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"apiKey" | ||
] | ||
}, | ||
name: { | ||
type: "string" | ||
}, | ||
"in": { | ||
type: "string", | ||
"enum": [ | ||
"header", | ||
"query" | ||
] | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
oauth2ImplicitSecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type", | ||
"flow", | ||
"authorizationUrl" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"oauth2" | ||
] | ||
}, | ||
flow: { | ||
type: "string", | ||
"enum": [ | ||
"implicit" | ||
] | ||
}, | ||
scopes: { | ||
$ref: "#/definitions/oauth2Scopes" | ||
}, | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
oauth2PasswordSecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type", | ||
"flow", | ||
"tokenUrl" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"oauth2" | ||
] | ||
}, | ||
flow: { | ||
type: "string", | ||
"enum": [ | ||
"password" | ||
] | ||
}, | ||
scopes: { | ||
$ref: "#/definitions/oauth2Scopes" | ||
}, | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
oauth2ApplicationSecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type", | ||
"flow", | ||
"tokenUrl" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"oauth2" | ||
] | ||
}, | ||
flow: { | ||
type: "string", | ||
"enum": [ | ||
"application" | ||
] | ||
}, | ||
scopes: { | ||
$ref: "#/definitions/oauth2Scopes" | ||
}, | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
oauth2AccessCodeSecurity: { | ||
type: "object", | ||
additionalProperties: false, | ||
required: [ | ||
"type", | ||
"flow", | ||
"authorizationUrl", | ||
"tokenUrl" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"oauth2" | ||
] | ||
}, | ||
flow: { | ||
type: "string", | ||
"enum": [ | ||
"accessCode" | ||
] | ||
}, | ||
scopes: { | ||
$ref: "#/definitions/oauth2Scopes" | ||
}, | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
$ref: "#/definitions/vendorExtension" | ||
} | ||
} | ||
}, | ||
oauth2Scopes: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
}, | ||
mediaTypeList: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/mimeType" | ||
}, | ||
uniqueItems: true | ||
}, | ||
parametersList: { | ||
type: "array", | ||
description: "The parameters needed to send a valid API call.", | ||
additionalItems: false, | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/parameter" | ||
}, | ||
{ | ||
$ref: "#/definitions/jsonReference" | ||
} | ||
] | ||
}, | ||
uniqueItems: true | ||
}, | ||
schemesList: { | ||
type: "array", | ||
description: "The transfer protocol of the API.", | ||
items: { | ||
type: "string", | ||
"enum": [ | ||
"http", | ||
"https", | ||
"ws", | ||
"wss" | ||
] | ||
}, | ||
uniqueItems: true | ||
}, | ||
collectionFormat: { | ||
type: "string", | ||
"enum": [ | ||
"csv", | ||
"ssv", | ||
"tsv", | ||
"pipes" | ||
], | ||
"default": "csv" | ||
}, | ||
collectionFormatWithMulti: { | ||
type: "string", | ||
"enum": [ | ||
"csv", | ||
"ssv", | ||
"tsv", | ||
"pipes", | ||
"multi" | ||
], | ||
"default": "csv" | ||
}, | ||
title: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/title" | ||
}, | ||
description: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/description" | ||
}, | ||
"default": { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/default" | ||
}, | ||
multipleOf: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/multipleOf" | ||
}, | ||
maximum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/maximum" | ||
}, | ||
exclusiveMaximum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" | ||
}, | ||
minimum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/minimum" | ||
}, | ||
exclusiveMinimum: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" | ||
}, | ||
maxLength: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" | ||
}, | ||
minLength: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" | ||
}, | ||
pattern: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/pattern" | ||
}, | ||
maxItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" | ||
}, | ||
minItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" | ||
}, | ||
uniqueItems: { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/uniqueItems" | ||
}, | ||
"enum": { | ||
$ref: "http://json-schema.org/draft-04/schema#/properties/enum" | ||
}, | ||
jsonReference: { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
], | ||
additionalProperties: false, | ||
properties: { | ||
$ref: { | ||
type: "string" | ||
} | ||
} | ||
} | ||
}; | ||
var Swagger20 = { | ||
title: title, | ||
id: id, | ||
$schema: $schema, | ||
type: type, | ||
required: required, | ||
additionalProperties: additionalProperties, | ||
patternProperties: patternProperties, | ||
properties: properties, | ||
definitions: definitions | ||
}; | ||
export { $schema, additionalProperties, Swagger20 as default, definitions, id, patternProperties, properties, required, title, type }; |
@@ -1,1 +0,1673 @@ | ||
var e="https://spec.openapis.org/oas/3.0/schema/2021-09-28",t="http://json-schema.org/draft-04/schema#",r="The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3",i="object",n=["openapi","info","paths"],o={openapi:{type:"string",pattern:"^3\\.0\\.\\d(-.+)?$"},info:{$ref:"#/definitions/Info"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},tags:{type:"array",items:{$ref:"#/definitions/Tag"},uniqueItems:!0},paths:{$ref:"#/definitions/Paths"},components:{$ref:"#/definitions/Components"}},p={"^x-":{}},s=!1,a={Reference:{type:"object",required:["$ref"],patternProperties:{"^\\$ref$":{type:"string",format:"uri-reference"}}},Info:{type:"object",required:["title","version"],properties:{title:{type:"string"},description:{type:"string"},termsOfService:{type:"string",format:"uri-reference"},contact:{$ref:"#/definitions/Contact"},license:{$ref:"#/definitions/License"},version:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Contact:{type:"object",properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"},email:{type:"string",format:"email"}},patternProperties:{"^x-":{}},additionalProperties:!1},License:{type:"object",required:["name"],properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Server:{type:"object",required:["url"],properties:{url:{type:"string"},description:{type:"string"},variables:{type:"object",additionalProperties:{$ref:"#/definitions/ServerVariable"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ServerVariable:{type:"object",required:["default"],properties:{enum:{type:"array",items:{type:"string"}},default:{type:"string"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Components:{type:"object",properties:{schemas:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}}},responses:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Response"}]}}},parameters:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Parameter"}]}}},examples:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Example"}]}}},requestBodies:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/RequestBody"}]}}},headers:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Header"}]}}},securitySchemes:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/SecurityScheme"}]}}},links:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Link"}]}}},callbacks:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Callback"}]}}}},patternProperties:{"^x-":{}},additionalProperties:!1},Schema:{type:"object",properties:{title:{type:"string"},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0,default:0},pattern:{type:"string",format:"regex"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0,default:0},uniqueItems:{type:"boolean",default:!1},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0,default:0},required:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},enum:{type:"array",items:{},minItems:1,uniqueItems:!1},type:{type:"string",enum:["array","boolean","integer","number","object","string"]},not:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},allOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},oneOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},anyOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},properties:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"},{type:"boolean"}],default:!0},description:{type:"string"},format:{type:"string"},default:{},nullable:{type:"boolean",default:!1},discriminator:{$ref:"#/definitions/Discriminator"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},example:{},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},deprecated:{type:"boolean",default:!1},xml:{$ref:"#/definitions/XML"}},patternProperties:{"^x-":{}},additionalProperties:!1},Discriminator:{type:"object",required:["propertyName"],properties:{propertyName:{type:"string"},mapping:{type:"object",additionalProperties:{type:"string"}}}},XML:{type:"object",properties:{name:{type:"string"},namespace:{type:"string",format:"uri"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},Response:{type:"object",required:["description"],properties:{description:{type:"string"},headers:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Header"},{$ref:"#/definitions/Reference"}]}},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},links:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Link"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1},MediaType:{type:"object",properties:{schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}},encoding:{type:"object",additionalProperties:{$ref:"#/definitions/Encoding"}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"}]},Example:{type:"object",properties:{summary:{type:"string"},description:{type:"string"},value:{},externalValue:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Header:{type:"object",properties:{description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string",enum:["simple"],default:"simple"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"}]},Paths:{type:"object",patternProperties:{"^\\/":{$ref:"#/definitions/PathItem"},"^x-":{}},additionalProperties:!1},PathItem:{type:"object",properties:{$ref:{type:"string"},summary:{type:"string"},description:{type:"string"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0}},patternProperties:{"^(get|put|post|delete|options|head|patch|trace)$":{$ref:"#/definitions/Operation"},"^x-":{}},additionalProperties:!1},Operation:{type:"object",required:["responses"],properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},operationId:{type:"string"},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0},requestBody:{oneOf:[{$ref:"#/definitions/RequestBody"},{$ref:"#/definitions/Reference"}]},responses:{$ref:"#/definitions/Responses"},callbacks:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Callback"},{$ref:"#/definitions/Reference"}]}},deprecated:{type:"boolean",default:!1},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},servers:{type:"array",items:{$ref:"#/definitions/Server"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Responses:{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]}},patternProperties:{"^[1-5](?:\\d{2}|XX)$":{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]},"^x-":{}},minProperties:1,additionalProperties:!1},SecurityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},Tag:{type:"object",required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExternalDocumentation:{type:"object",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExampleXORExamples:{description:"Example and examples are mutually exclusive",not:{required:["example","examples"]}},SchemaXORContent:{description:"Schema and content are mutually exclusive, at least one is required",not:{required:["schema","content"]},oneOf:[{required:["schema"]},{required:["content"],description:"Some properties are not allowed if content is present",allOf:[{not:{required:["style"]}},{not:{required:["explode"]}},{not:{required:["allowReserved"]}},{not:{required:["example"]}},{not:{required:["examples"]}}]}]},Parameter:{type:"object",properties:{name:{type:"string"},in:{type:"string"},description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,required:["name","in"],allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"},{$ref:"#/definitions/ParameterLocation"}]},ParameterLocation:{description:"Parameter location",oneOf:[{description:"Parameter in path",required:["required"],properties:{in:{enum:["path"]},style:{enum:["matrix","label","simple"],default:"simple"},required:{enum:[!0]}}},{description:"Parameter in query",properties:{in:{enum:["query"]},style:{enum:["form","spaceDelimited","pipeDelimited","deepObject"],default:"form"}}},{description:"Parameter in header",properties:{in:{enum:["header"]},style:{enum:["simple"],default:"simple"}}},{description:"Parameter in cookie",properties:{in:{enum:["cookie"]},style:{enum:["form"],default:"form"}}}]},RequestBody:{type:"object",required:["content"],properties:{description:{type:"string"},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},required:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},SecurityScheme:{oneOf:[{$ref:"#/definitions/APIKeySecurityScheme"},{$ref:"#/definitions/HTTPSecurityScheme"},{$ref:"#/definitions/OAuth2SecurityScheme"},{$ref:"#/definitions/OpenIdConnectSecurityScheme"}]},APIKeySecurityScheme:{type:"object",required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query","cookie"]},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},HTTPSecurityScheme:{type:"object",required:["scheme","type"],properties:{scheme:{type:"string"},bearerFormat:{type:"string"},description:{type:"string"},type:{type:"string",enum:["http"]}},patternProperties:{"^x-":{}},additionalProperties:!1,oneOf:[{description:"Bearer",properties:{scheme:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}}},{description:"Non Bearer",not:{required:["bearerFormat"]},properties:{scheme:{not:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}}}}]},OAuth2SecurityScheme:{type:"object",required:["type","flows"],properties:{type:{type:"string",enum:["oauth2"]},flows:{$ref:"#/definitions/OAuthFlows"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OpenIdConnectSecurityScheme:{type:"object",required:["type","openIdConnectUrl"],properties:{type:{type:"string",enum:["openIdConnect"]},openIdConnectUrl:{type:"string",format:"uri-reference"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OAuthFlows:{type:"object",properties:{implicit:{$ref:"#/definitions/ImplicitOAuthFlow"},password:{$ref:"#/definitions/PasswordOAuthFlow"},clientCredentials:{$ref:"#/definitions/ClientCredentialsFlow"},authorizationCode:{$ref:"#/definitions/AuthorizationCodeOAuthFlow"}},patternProperties:{"^x-":{}},additionalProperties:!1},ImplicitOAuthFlow:{type:"object",required:["authorizationUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},PasswordOAuthFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ClientCredentialsFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},AuthorizationCodeOAuthFlow:{type:"object",required:["authorizationUrl","tokenUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Link:{type:"object",properties:{operationId:{type:"string"},operationRef:{type:"string",format:"uri-reference"},parameters:{type:"object",additionalProperties:{}},requestBody:{},description:{type:"string"},server:{$ref:"#/definitions/Server"}},patternProperties:{"^x-":{}},additionalProperties:!1,not:{description:"Operation Id and Operation Ref are mutually exclusive",required:["operationId","operationRef"]}},Callback:{type:"object",additionalProperties:{$ref:"#/definitions/PathItem"},patternProperties:{"^x-":{}}},Encoding:{type:"object",properties:{contentType:{type:"string"},headers:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Header"},{$ref:"#/definitions/Reference"}]}},style:{type:"string",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1}},additionalProperties:!1}},d={id:e,$schema:t,description:r,type:i,required:n,properties:o,patternProperties:p,additionalProperties:s,definitions:a};export{t as $schema,s as additionalProperties,d as default,a as definitions,r as description,e as id,p as patternProperties,o as properties,n as required,i as type}; | ||
var id = "https://spec.openapis.org/oas/3.0/schema/2021-09-28"; | ||
var $schema = "http://json-schema.org/draft-04/schema#"; | ||
var description = "The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3"; | ||
var type = "object"; | ||
var required = [ | ||
"openapi", | ||
"info", | ||
"paths" | ||
]; | ||
var properties = { | ||
openapi: { | ||
type: "string", | ||
pattern: "^3\\.0\\.\\d(-.+)?$" | ||
}, | ||
info: { | ||
$ref: "#/definitions/Info" | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/ExternalDocumentation" | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/Server" | ||
} | ||
}, | ||
security: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/SecurityRequirement" | ||
} | ||
}, | ||
tags: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/Tag" | ||
}, | ||
uniqueItems: true | ||
}, | ||
paths: { | ||
$ref: "#/definitions/Paths" | ||
}, | ||
components: { | ||
$ref: "#/definitions/Components" | ||
} | ||
}; | ||
var patternProperties = { | ||
"^x-": { | ||
} | ||
}; | ||
var additionalProperties = false; | ||
var definitions = { | ||
Reference: { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
], | ||
patternProperties: { | ||
"^\\$ref$": { | ||
type: "string", | ||
format: "uri-reference" | ||
} | ||
} | ||
}, | ||
Info: { | ||
type: "object", | ||
required: [ | ||
"title", | ||
"version" | ||
], | ||
properties: { | ||
title: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
termsOfService: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
contact: { | ||
$ref: "#/definitions/Contact" | ||
}, | ||
license: { | ||
$ref: "#/definitions/License" | ||
}, | ||
version: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Contact: { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
email: { | ||
type: "string", | ||
format: "email" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
License: { | ||
type: "object", | ||
required: [ | ||
"name" | ||
], | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri-reference" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Server: { | ||
type: "object", | ||
required: [ | ||
"url" | ||
], | ||
properties: { | ||
url: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
variables: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/ServerVariable" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
ServerVariable: { | ||
type: "object", | ||
required: [ | ||
"default" | ||
], | ||
properties: { | ||
"enum": { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
} | ||
}, | ||
"default": { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Components: { | ||
type: "object", | ||
properties: { | ||
schemas: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
responses: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Response" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
parameters: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Parameter" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
examples: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Example" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
requestBodies: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/RequestBody" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
headers: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Header" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
securitySchemes: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/SecurityScheme" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
links: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Link" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
callbacks: { | ||
type: "object", | ||
patternProperties: { | ||
"^[a-zA-Z0-9\\.\\-_]+$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
$ref: "#/definitions/Callback" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Schema: { | ||
type: "object", | ||
properties: { | ||
title: { | ||
type: "string" | ||
}, | ||
multipleOf: { | ||
type: "number", | ||
minimum: 0, | ||
exclusiveMinimum: true | ||
}, | ||
maximum: { | ||
type: "number" | ||
}, | ||
exclusiveMaximum: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
minimum: { | ||
type: "number" | ||
}, | ||
exclusiveMinimum: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
maxLength: { | ||
type: "integer", | ||
minimum: 0 | ||
}, | ||
minLength: { | ||
type: "integer", | ||
minimum: 0, | ||
"default": 0 | ||
}, | ||
pattern: { | ||
type: "string", | ||
format: "regex" | ||
}, | ||
maxItems: { | ||
type: "integer", | ||
minimum: 0 | ||
}, | ||
minItems: { | ||
type: "integer", | ||
minimum: 0, | ||
"default": 0 | ||
}, | ||
uniqueItems: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
maxProperties: { | ||
type: "integer", | ||
minimum: 0 | ||
}, | ||
minProperties: { | ||
type: "integer", | ||
minimum: 0, | ||
"default": 0 | ||
}, | ||
required: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
}, | ||
minItems: 1, | ||
uniqueItems: true | ||
}, | ||
"enum": { | ||
type: "array", | ||
items: { | ||
}, | ||
minItems: 1, | ||
uniqueItems: false | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"array", | ||
"boolean", | ||
"integer", | ||
"number", | ||
"object", | ||
"string" | ||
] | ||
}, | ||
not: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
allOf: { | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
oneOf: { | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
anyOf: { | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
properties: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
}, | ||
{ | ||
type: "boolean" | ||
} | ||
], | ||
"default": true | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
format: { | ||
type: "string" | ||
}, | ||
"default": { | ||
}, | ||
nullable: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
discriminator: { | ||
$ref: "#/definitions/Discriminator" | ||
}, | ||
readOnly: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
writeOnly: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
example: { | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/ExternalDocumentation" | ||
}, | ||
deprecated: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
xml: { | ||
$ref: "#/definitions/XML" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Discriminator: { | ||
type: "object", | ||
required: [ | ||
"propertyName" | ||
], | ||
properties: { | ||
propertyName: { | ||
type: "string" | ||
}, | ||
mapping: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
} | ||
}, | ||
XML: { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
namespace: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
prefix: { | ||
type: "string" | ||
}, | ||
attribute: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
wrapped: { | ||
type: "boolean", | ||
"default": false | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Response: { | ||
type: "object", | ||
required: [ | ||
"description" | ||
], | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Header" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
content: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/MediaType" | ||
} | ||
}, | ||
links: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Link" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
MediaType: { | ||
type: "object", | ||
properties: { | ||
schema: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
example: { | ||
}, | ||
examples: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Example" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
encoding: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/Encoding" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false, | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/ExampleXORExamples" | ||
} | ||
] | ||
}, | ||
Example: { | ||
type: "object", | ||
properties: { | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
value: { | ||
}, | ||
externalValue: { | ||
type: "string", | ||
format: "uri-reference" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Header: { | ||
type: "object", | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
required: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
deprecated: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
allowEmptyValue: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
style: { | ||
type: "string", | ||
"enum": [ | ||
"simple" | ||
], | ||
"default": "simple" | ||
}, | ||
explode: { | ||
type: "boolean" | ||
}, | ||
allowReserved: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
schema: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
content: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/MediaType" | ||
}, | ||
minProperties: 1, | ||
maxProperties: 1 | ||
}, | ||
example: { | ||
}, | ||
examples: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Example" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false, | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/ExampleXORExamples" | ||
}, | ||
{ | ||
$ref: "#/definitions/SchemaXORContent" | ||
} | ||
] | ||
}, | ||
Paths: { | ||
type: "object", | ||
patternProperties: { | ||
"^\\/": { | ||
$ref: "#/definitions/PathItem" | ||
}, | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
PathItem: { | ||
type: "object", | ||
properties: { | ||
$ref: { | ||
type: "string" | ||
}, | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/Server" | ||
} | ||
}, | ||
parameters: { | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Parameter" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
uniqueItems: true | ||
} | ||
}, | ||
patternProperties: { | ||
"^(get|put|post|delete|options|head|patch|trace)$": { | ||
$ref: "#/definitions/Operation" | ||
}, | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Operation: { | ||
type: "object", | ||
required: [ | ||
"responses" | ||
], | ||
properties: { | ||
tags: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
} | ||
}, | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/ExternalDocumentation" | ||
}, | ||
operationId: { | ||
type: "string" | ||
}, | ||
parameters: { | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Parameter" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
uniqueItems: true | ||
}, | ||
requestBody: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/RequestBody" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
responses: { | ||
$ref: "#/definitions/Responses" | ||
}, | ||
callbacks: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Callback" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
deprecated: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
security: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/SecurityRequirement" | ||
} | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/definitions/Server" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Responses: { | ||
type: "object", | ||
properties: { | ||
"default": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Response" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
patternProperties: { | ||
"^[1-5](?:\\d{2}|XX)$": { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Response" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
"^x-": { | ||
} | ||
}, | ||
minProperties: 1, | ||
additionalProperties: false | ||
}, | ||
SecurityRequirement: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
Tag: { | ||
type: "object", | ||
required: [ | ||
"name" | ||
], | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
externalDocs: { | ||
$ref: "#/definitions/ExternalDocumentation" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
ExternalDocumentation: { | ||
type: "object", | ||
required: [ | ||
"url" | ||
], | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri-reference" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
ExampleXORExamples: { | ||
description: "Example and examples are mutually exclusive", | ||
not: { | ||
required: [ | ||
"example", | ||
"examples" | ||
] | ||
} | ||
}, | ||
SchemaXORContent: { | ||
description: "Schema and content are mutually exclusive, at least one is required", | ||
not: { | ||
required: [ | ||
"schema", | ||
"content" | ||
] | ||
}, | ||
oneOf: [ | ||
{ | ||
required: [ | ||
"schema" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"content" | ||
], | ||
description: "Some properties are not allowed if content is present", | ||
allOf: [ | ||
{ | ||
not: { | ||
required: [ | ||
"style" | ||
] | ||
} | ||
}, | ||
{ | ||
not: { | ||
required: [ | ||
"explode" | ||
] | ||
} | ||
}, | ||
{ | ||
not: { | ||
required: [ | ||
"allowReserved" | ||
] | ||
} | ||
}, | ||
{ | ||
not: { | ||
required: [ | ||
"example" | ||
] | ||
} | ||
}, | ||
{ | ||
not: { | ||
required: [ | ||
"examples" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
Parameter: { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
"in": { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
required: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
deprecated: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
allowEmptyValue: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
style: { | ||
type: "string" | ||
}, | ||
explode: { | ||
type: "boolean" | ||
}, | ||
allowReserved: { | ||
type: "boolean", | ||
"default": false | ||
}, | ||
schema: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Schema" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
}, | ||
content: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/MediaType" | ||
}, | ||
minProperties: 1, | ||
maxProperties: 1 | ||
}, | ||
example: { | ||
}, | ||
examples: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Example" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false, | ||
required: [ | ||
"name", | ||
"in" | ||
], | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/ExampleXORExamples" | ||
}, | ||
{ | ||
$ref: "#/definitions/SchemaXORContent" | ||
}, | ||
{ | ||
$ref: "#/definitions/ParameterLocation" | ||
} | ||
] | ||
}, | ||
ParameterLocation: { | ||
description: "Parameter location", | ||
oneOf: [ | ||
{ | ||
description: "Parameter in path", | ||
required: [ | ||
"required" | ||
], | ||
properties: { | ||
"in": { | ||
"enum": [ | ||
"path" | ||
] | ||
}, | ||
style: { | ||
"enum": [ | ||
"matrix", | ||
"label", | ||
"simple" | ||
], | ||
"default": "simple" | ||
}, | ||
required: { | ||
"enum": [ | ||
true | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
description: "Parameter in query", | ||
properties: { | ||
"in": { | ||
"enum": [ | ||
"query" | ||
] | ||
}, | ||
style: { | ||
"enum": [ | ||
"form", | ||
"spaceDelimited", | ||
"pipeDelimited", | ||
"deepObject" | ||
], | ||
"default": "form" | ||
} | ||
} | ||
}, | ||
{ | ||
description: "Parameter in header", | ||
properties: { | ||
"in": { | ||
"enum": [ | ||
"header" | ||
] | ||
}, | ||
style: { | ||
"enum": [ | ||
"simple" | ||
], | ||
"default": "simple" | ||
} | ||
} | ||
}, | ||
{ | ||
description: "Parameter in cookie", | ||
properties: { | ||
"in": { | ||
"enum": [ | ||
"cookie" | ||
] | ||
}, | ||
style: { | ||
"enum": [ | ||
"form" | ||
], | ||
"default": "form" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
RequestBody: { | ||
type: "object", | ||
required: [ | ||
"content" | ||
], | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
content: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/MediaType" | ||
} | ||
}, | ||
required: { | ||
type: "boolean", | ||
"default": false | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
SecurityScheme: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/APIKeySecurityScheme" | ||
}, | ||
{ | ||
$ref: "#/definitions/HTTPSecurityScheme" | ||
}, | ||
{ | ||
$ref: "#/definitions/OAuth2SecurityScheme" | ||
}, | ||
{ | ||
$ref: "#/definitions/OpenIdConnectSecurityScheme" | ||
} | ||
] | ||
}, | ||
APIKeySecurityScheme: { | ||
type: "object", | ||
required: [ | ||
"type", | ||
"name", | ||
"in" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"apiKey" | ||
] | ||
}, | ||
name: { | ||
type: "string" | ||
}, | ||
"in": { | ||
type: "string", | ||
"enum": [ | ||
"header", | ||
"query", | ||
"cookie" | ||
] | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
HTTPSecurityScheme: { | ||
type: "object", | ||
required: [ | ||
"scheme", | ||
"type" | ||
], | ||
properties: { | ||
scheme: { | ||
type: "string" | ||
}, | ||
bearerFormat: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"http" | ||
] | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false, | ||
oneOf: [ | ||
{ | ||
description: "Bearer", | ||
properties: { | ||
scheme: { | ||
type: "string", | ||
pattern: "^[Bb][Ee][Aa][Rr][Ee][Rr]$" | ||
} | ||
} | ||
}, | ||
{ | ||
description: "Non Bearer", | ||
not: { | ||
required: [ | ||
"bearerFormat" | ||
] | ||
}, | ||
properties: { | ||
scheme: { | ||
not: { | ||
type: "string", | ||
pattern: "^[Bb][Ee][Aa][Rr][Ee][Rr]$" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
OAuth2SecurityScheme: { | ||
type: "object", | ||
required: [ | ||
"type", | ||
"flows" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"oauth2" | ||
] | ||
}, | ||
flows: { | ||
$ref: "#/definitions/OAuthFlows" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
OpenIdConnectSecurityScheme: { | ||
type: "object", | ||
required: [ | ||
"type", | ||
"openIdConnectUrl" | ||
], | ||
properties: { | ||
type: { | ||
type: "string", | ||
"enum": [ | ||
"openIdConnect" | ||
] | ||
}, | ||
openIdConnectUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
OAuthFlows: { | ||
type: "object", | ||
properties: { | ||
implicit: { | ||
$ref: "#/definitions/ImplicitOAuthFlow" | ||
}, | ||
password: { | ||
$ref: "#/definitions/PasswordOAuthFlow" | ||
}, | ||
clientCredentials: { | ||
$ref: "#/definitions/ClientCredentialsFlow" | ||
}, | ||
authorizationCode: { | ||
$ref: "#/definitions/AuthorizationCodeOAuthFlow" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
ImplicitOAuthFlow: { | ||
type: "object", | ||
required: [ | ||
"authorizationUrl", | ||
"scopes" | ||
], | ||
properties: { | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
scopes: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
PasswordOAuthFlow: { | ||
type: "object", | ||
required: [ | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
properties: { | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
scopes: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
ClientCredentialsFlow: { | ||
type: "object", | ||
required: [ | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
properties: { | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
scopes: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
AuthorizationCodeOAuthFlow: { | ||
type: "object", | ||
required: [ | ||
"authorizationUrl", | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
properties: { | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
scopes: { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false | ||
}, | ||
Link: { | ||
type: "object", | ||
properties: { | ||
operationId: { | ||
type: "string" | ||
}, | ||
operationRef: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
parameters: { | ||
type: "object", | ||
additionalProperties: { | ||
} | ||
}, | ||
requestBody: { | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
server: { | ||
$ref: "#/definitions/Server" | ||
} | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
}, | ||
additionalProperties: false, | ||
not: { | ||
description: "Operation Id and Operation Ref are mutually exclusive", | ||
required: [ | ||
"operationId", | ||
"operationRef" | ||
] | ||
} | ||
}, | ||
Callback: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/definitions/PathItem" | ||
}, | ||
patternProperties: { | ||
"^x-": { | ||
} | ||
} | ||
}, | ||
Encoding: { | ||
type: "object", | ||
properties: { | ||
contentType: { | ||
type: "string" | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
oneOf: [ | ||
{ | ||
$ref: "#/definitions/Header" | ||
}, | ||
{ | ||
$ref: "#/definitions/Reference" | ||
} | ||
] | ||
} | ||
}, | ||
style: { | ||
type: "string", | ||
"enum": [ | ||
"form", | ||
"spaceDelimited", | ||
"pipeDelimited", | ||
"deepObject" | ||
] | ||
}, | ||
explode: { | ||
type: "boolean" | ||
}, | ||
allowReserved: { | ||
type: "boolean", | ||
"default": false | ||
} | ||
}, | ||
additionalProperties: false | ||
} | ||
}; | ||
var OpenApi30 = { | ||
id: id, | ||
$schema: $schema, | ||
description: description, | ||
type: type, | ||
required: required, | ||
properties: properties, | ||
patternProperties: patternProperties, | ||
additionalProperties: additionalProperties, | ||
definitions: definitions | ||
}; | ||
export { $schema, additionalProperties, OpenApi30 as default, definitions, description, id, patternProperties, properties, required, type }; |
@@ -1,1 +0,1451 @@ | ||
var e="https://spec.openapis.org/oas/3.1/schema/2022-10-07",t="https://json-schema.org/draft/2020-12/schema",r="The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0",s="object",o={openapi:{type:"string",pattern:"^3\\.1\\.\\d+(-.+)?$"},info:{$ref:"#/$defs/info"},jsonSchemaDialect:{type:"string",format:"uri",default:"https://spec.openapis.org/oas/3.1/dialect/base"},servers:{type:"array",items:{$ref:"#/$defs/server"},default:[{url:"/"}]},paths:{$ref:"#/$defs/paths"},webhooks:{type:"object",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}},components:{$ref:"#/$defs/components"},security:{type:"array",items:{$ref:"#/$defs/security-requirement"}},tags:{type:"array",items:{$ref:"#/$defs/tag"}},externalDocs:{$ref:"#/$defs/external-documentation"}},i=["openapi","info"],p=[{required:["paths"]},{required:["components"]},{required:["webhooks"]}],n="#/$defs/specification-extensions",a=!1,f={info:{$comment:"https://spec.openapis.org/oas/v3.1.0#info-object",type:"object",properties:{title:{type:"string"},summary:{type:"string"},description:{type:"string"},termsOfService:{type:"string",format:"uri"},contact:{$ref:"#/$defs/contact"},license:{$ref:"#/$defs/license"},version:{type:"string"}},required:["title","version"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},contact:{$comment:"https://spec.openapis.org/oas/v3.1.0#contact-object",type:"object",properties:{name:{type:"string"},url:{type:"string",format:"uri"},email:{type:"string",format:"email"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},license:{$comment:"https://spec.openapis.org/oas/v3.1.0#license-object",type:"object",properties:{name:{type:"string"},identifier:{type:"string"},url:{type:"string",format:"uri"}},required:["name"],dependentSchemas:{identifier:{not:{required:["url"]}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},server:{$comment:"https://spec.openapis.org/oas/v3.1.0#server-object",type:"object",properties:{url:{type:"string"},description:{type:"string"},variables:{type:"object",additionalProperties:{$ref:"#/$defs/server-variable"}}},required:["url"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"server-variable":{$comment:"https://spec.openapis.org/oas/v3.1.0#server-variable-object",type:"object",properties:{enum:{type:"array",items:{type:"string"},minItems:1},default:{type:"string"},description:{type:"string"}},required:["default"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},components:{$comment:"https://spec.openapis.org/oas/v3.1.0#components-object",type:"object",properties:{schemas:{type:"object",additionalProperties:{$ref:"#/$defs/schema"}},responses:{type:"object",additionalProperties:{$ref:"#/$defs/response-or-reference"}},parameters:{type:"object",additionalProperties:{$ref:"#/$defs/parameter-or-reference"}},examples:{type:"object",additionalProperties:{$ref:"#/$defs/example-or-reference"}},requestBodies:{type:"object",additionalProperties:{$ref:"#/$defs/request-body-or-reference"}},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},securitySchemes:{type:"object",additionalProperties:{$ref:"#/$defs/security-scheme-or-reference"}},links:{type:"object",additionalProperties:{$ref:"#/$defs/link-or-reference"}},callbacks:{type:"object",additionalProperties:{$ref:"#/$defs/callbacks-or-reference"}},pathItems:{type:"object",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}}},patternProperties:{"^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$":{$comment:"Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected",propertyNames:{pattern:"^[a-zA-Z0-9._-]+$"}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},paths:{$comment:"https://spec.openapis.org/oas/v3.1.0#paths-object",type:"object",patternProperties:{"^/":{$ref:"#/$defs/path-item"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"path-item":{$comment:"https://spec.openapis.org/oas/v3.1.0#path-item-object",type:"object",properties:{summary:{type:"string"},description:{type:"string"},servers:{type:"array",items:{$ref:"#/$defs/server"}},parameters:{type:"array",items:{$ref:"#/$defs/parameter-or-reference"}},get:{$ref:"#/$defs/operation"},put:{$ref:"#/$defs/operation"},post:{$ref:"#/$defs/operation"},delete:{$ref:"#/$defs/operation"},options:{$ref:"#/$defs/operation"},head:{$ref:"#/$defs/operation"},patch:{$ref:"#/$defs/operation"},trace:{$ref:"#/$defs/operation"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"path-item-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/path-item"}},operation:{$comment:"https://spec.openapis.org/oas/v3.1.0#operation-object",type:"object",properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/$defs/external-documentation"},operationId:{type:"string"},parameters:{type:"array",items:{$ref:"#/$defs/parameter-or-reference"}},requestBody:{$ref:"#/$defs/request-body-or-reference"},responses:{$ref:"#/$defs/responses"},callbacks:{type:"object",additionalProperties:{$ref:"#/$defs/callbacks-or-reference"}},deprecated:{default:!1,type:"boolean"},security:{type:"array",items:{$ref:"#/$defs/security-requirement"}},servers:{type:"array",items:{$ref:"#/$defs/server"}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"external-documentation":{$comment:"https://spec.openapis.org/oas/v3.1.0#external-documentation-object",type:"object",properties:{description:{type:"string"},url:{type:"string",format:"uri"}},required:["url"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},parameter:{$comment:"https://spec.openapis.org/oas/v3.1.0#parameter-object",type:"object",properties:{name:{type:"string"},in:{enum:["query","header","path","cookie"]},description:{type:"string"},required:{default:!1,type:"boolean"},deprecated:{default:!1,type:"boolean"},schema:{$ref:"#/$defs/schema"},content:{$ref:"#/$defs/content",minProperties:1,maxProperties:1}},required:["name","in"],oneOf:[{required:["schema"]},{required:["content"]}],if:{properties:{in:{const:"query"}},required:["in"]},then:{properties:{allowEmptyValue:{default:!1,type:"boolean"}}},dependentSchemas:{schema:{properties:{style:{type:"string"},explode:{type:"boolean"}},allOf:[{$ref:"#/$defs/examples"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form"}],$defs:{"styles-for-path":{if:{properties:{in:{const:"path"}},required:["in"]},then:{properties:{name:{pattern:"[^/#?]+$"},style:{default:"simple",enum:["matrix","label","simple"]},required:{const:!0}},required:["required"]}},"styles-for-header":{if:{properties:{in:{const:"header"}},required:["in"]},then:{properties:{style:{default:"simple",const:"simple"}}}},"styles-for-query":{if:{properties:{in:{const:"query"}},required:["in"]},then:{properties:{style:{default:"form",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},allowReserved:{default:!1,type:"boolean"}}}},"styles-for-cookie":{if:{properties:{in:{const:"cookie"}},required:["in"]},then:{properties:{style:{default:"form",const:"form"}}}},"styles-for-form":{if:{properties:{style:{const:"form"}},required:["style"]},then:{properties:{explode:{default:!0}}},else:{properties:{explode:{default:!1}}}}}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"parameter-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/parameter"}},"request-body":{$comment:"https://spec.openapis.org/oas/v3.1.0#request-body-object",type:"object",properties:{description:{type:"string"},content:{$ref:"#/$defs/content"},required:{default:!1,type:"boolean"}},required:["content"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"request-body-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/request-body"}},content:{$comment:"https://spec.openapis.org/oas/v3.1.0#fixed-fields-10",type:"object",additionalProperties:{$ref:"#/$defs/media-type"},propertyNames:{format:"media-range"}},"media-type":{$comment:"https://spec.openapis.org/oas/v3.1.0#media-type-object",type:"object",properties:{schema:{$ref:"#/$defs/schema"},encoding:{type:"object",additionalProperties:{$ref:"#/$defs/encoding"}}},allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/examples"}],unevaluatedProperties:!1},encoding:{$comment:"https://spec.openapis.org/oas/v3.1.0#encoding-object",type:"object",properties:{contentType:{type:"string",format:"media-range"},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},style:{default:"form",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{default:!1,type:"boolean"}},allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/encoding/$defs/explode-default"}],unevaluatedProperties:!1,$defs:{"explode-default":{if:{properties:{style:{const:"form"}},required:["style"]},then:{properties:{explode:{default:!0}}},else:{properties:{explode:{default:!1}}}}}},responses:{$comment:"https://spec.openapis.org/oas/v3.1.0#responses-object",type:"object",properties:{default:{$ref:"#/$defs/response-or-reference"}},patternProperties:{"^[1-5](?:[0-9]{2}|XX)$":{$ref:"#/$defs/response-or-reference"}},minProperties:1,$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},response:{$comment:"https://spec.openapis.org/oas/v3.1.0#response-object",type:"object",properties:{description:{type:"string"},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},content:{$ref:"#/$defs/content"},links:{type:"object",additionalProperties:{$ref:"#/$defs/link-or-reference"}}},required:["description"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"response-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/response"}},callbacks:{$comment:"https://spec.openapis.org/oas/v3.1.0#callback-object",type:"object",$ref:"#/$defs/specification-extensions",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}},"callbacks-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/callbacks"}},example:{$comment:"https://spec.openapis.org/oas/v3.1.0#example-object",type:"object",properties:{summary:{type:"string"},description:{type:"string"},value:!0,externalValue:{type:"string",format:"uri"}},not:{required:["value","externalValue"]},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"example-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/example"}},link:{$comment:"https://spec.openapis.org/oas/v3.1.0#link-object",type:"object",properties:{operationRef:{type:"string",format:"uri-reference"},operationId:{type:"string"},parameters:{$ref:"#/$defs/map-of-strings"},requestBody:!0,description:{type:"string"},body:{$ref:"#/$defs/server"}},oneOf:[{required:["operationRef"]},{required:["operationId"]}],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"link-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/link"}},header:{$comment:"https://spec.openapis.org/oas/v3.1.0#header-object",type:"object",properties:{description:{type:"string"},required:{default:!1,type:"boolean"},deprecated:{default:!1,type:"boolean"},schema:{$ref:"#/$defs/schema"},content:{$ref:"#/$defs/content",minProperties:1,maxProperties:1}},oneOf:[{required:["schema"]},{required:["content"]}],dependentSchemas:{schema:{properties:{style:{default:"simple",const:"simple"},explode:{default:!1,type:"boolean"}},$ref:"#/$defs/examples"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"header-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/header"}},tag:{$comment:"https://spec.openapis.org/oas/v3.1.0#tag-object",type:"object",properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/$defs/external-documentation"}},required:["name"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},reference:{$comment:"https://spec.openapis.org/oas/v3.1.0#reference-object",type:"object",properties:{$ref:{type:"string",format:"uri-reference"},summary:{type:"string"},description:{type:"string"}},unevaluatedProperties:!1},schema:{$comment:"https://spec.openapis.org/oas/v3.1.0#schema-object",$dynamicAnchor:"meta",type:["object","boolean"]},"security-scheme":{$comment:"https://spec.openapis.org/oas/v3.1.0#security-scheme-object",type:"object",properties:{type:{enum:["apiKey","http","mutualTLS","oauth2","openIdConnect"]},description:{type:"string"}},required:["type"],allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/security-scheme/$defs/type-apikey"},{$ref:"#/$defs/security-scheme/$defs/type-http"},{$ref:"#/$defs/security-scheme/$defs/type-http-bearer"},{$ref:"#/$defs/security-scheme/$defs/type-oauth2"},{$ref:"#/$defs/security-scheme/$defs/type-oidc"}],unevaluatedProperties:!1,$defs:{"type-apikey":{if:{properties:{type:{const:"apiKey"}},required:["type"]},then:{properties:{name:{type:"string"},in:{enum:["query","header","cookie"]}},required:["name","in"]}},"type-http":{if:{properties:{type:{const:"http"}},required:["type"]},then:{properties:{scheme:{type:"string"}},required:["scheme"]}},"type-http-bearer":{if:{properties:{type:{const:"http"},scheme:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}},required:["type","scheme"]},then:{properties:{bearerFormat:{type:"string"}}}},"type-oauth2":{if:{properties:{type:{const:"oauth2"}},required:["type"]},then:{properties:{flows:{$ref:"#/$defs/oauth-flows"}},required:["flows"]}},"type-oidc":{if:{properties:{type:{const:"openIdConnect"}},required:["type"]},then:{properties:{openIdConnectUrl:{type:"string",format:"uri"}},required:["openIdConnectUrl"]}}}},"security-scheme-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/security-scheme"}},"oauth-flows":{type:"object",properties:{implicit:{$ref:"#/$defs/oauth-flows/$defs/implicit"},password:{$ref:"#/$defs/oauth-flows/$defs/password"},clientCredentials:{$ref:"#/$defs/oauth-flows/$defs/client-credentials"},authorizationCode:{$ref:"#/$defs/oauth-flows/$defs/authorization-code"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1,$defs:{implicit:{type:"object",properties:{authorizationUrl:{type:"string",format:"uri"},refreshUrl:{type:"string",format:"uri"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["authorizationUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},password:{type:"object",properties:{tokenUrl:{type:"string",format:"uri"},refreshUrl:{type:"string",format:"uri"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"client-credentials":{type:"object",properties:{tokenUrl:{type:"string",format:"uri"},refreshUrl:{type:"string",format:"uri"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"authorization-code":{type:"object",properties:{authorizationUrl:{type:"string",format:"uri"},tokenUrl:{type:"string",format:"uri"},refreshUrl:{type:"string",format:"uri"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["authorizationUrl","tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1}}},"security-requirement":{$comment:"https://spec.openapis.org/oas/v3.1.0#security-requirement-object",type:"object",additionalProperties:{type:"array",items:{type:"string"}}},"specification-extensions":{$comment:"https://spec.openapis.org/oas/v3.1.0#specification-extensions",patternProperties:{"^x-":!0}},examples:{properties:{example:!0,examples:{type:"object",additionalProperties:{$ref:"#/$defs/example-or-reference"}}}},"map-of-strings":{type:"object",additionalProperties:{type:"string"}}},c={$id:e,$schema:t,description:r,type:s,properties:o,required:i,anyOf:p,$ref:n,unevaluatedProperties:a,$defs:f};export{f as $defs,e as $id,n as $ref,t as $schema,p as anyOf,c as default,r as description,o as properties,i as required,s as type,a as unevaluatedProperties}; | ||
var $id = "https://spec.openapis.org/oas/3.1/schema/2022-10-07"; | ||
var $schema = "https://json-schema.org/draft/2020-12/schema"; | ||
var description = "The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0"; | ||
var type = "object"; | ||
var properties = { | ||
openapi: { | ||
type: "string", | ||
pattern: "^3\\.1\\.\\d+(-.+)?$" | ||
}, | ||
info: { | ||
$ref: "#/$defs/info" | ||
}, | ||
jsonSchemaDialect: { | ||
type: "string", | ||
format: "uri", | ||
"default": "https://spec.openapis.org/oas/3.1/dialect/base" | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/server" | ||
}, | ||
"default": [ | ||
{ | ||
url: "/" | ||
} | ||
] | ||
}, | ||
paths: { | ||
$ref: "#/$defs/paths" | ||
}, | ||
webhooks: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/path-item-or-reference" | ||
} | ||
}, | ||
components: { | ||
$ref: "#/$defs/components" | ||
}, | ||
security: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/security-requirement" | ||
} | ||
}, | ||
tags: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/tag" | ||
} | ||
}, | ||
externalDocs: { | ||
$ref: "#/$defs/external-documentation" | ||
} | ||
}; | ||
var required = [ | ||
"openapi", | ||
"info" | ||
]; | ||
var anyOf = [ | ||
{ | ||
required: [ | ||
"paths" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"components" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"webhooks" | ||
] | ||
} | ||
]; | ||
var $ref = "#/$defs/specification-extensions"; | ||
var unevaluatedProperties = false; | ||
var $defs = { | ||
info: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#info-object", | ||
type: "object", | ||
properties: { | ||
title: { | ||
type: "string" | ||
}, | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
termsOfService: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
contact: { | ||
$ref: "#/$defs/contact" | ||
}, | ||
license: { | ||
$ref: "#/$defs/license" | ||
}, | ||
version: { | ||
type: "string" | ||
} | ||
}, | ||
required: [ | ||
"title", | ||
"version" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
contact: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#contact-object", | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
email: { | ||
type: "string", | ||
format: "email" | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
license: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#license-object", | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
identifier: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri" | ||
} | ||
}, | ||
required: [ | ||
"name" | ||
], | ||
dependentSchemas: { | ||
identifier: { | ||
not: { | ||
required: [ | ||
"url" | ||
] | ||
} | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
server: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#server-object", | ||
type: "object", | ||
properties: { | ||
url: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
variables: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/server-variable" | ||
} | ||
} | ||
}, | ||
required: [ | ||
"url" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"server-variable": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#server-variable-object", | ||
type: "object", | ||
properties: { | ||
"enum": { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
}, | ||
minItems: 1 | ||
}, | ||
"default": { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
required: [ | ||
"default" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
components: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#components-object", | ||
type: "object", | ||
properties: { | ||
schemas: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/schema" | ||
} | ||
}, | ||
responses: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/response-or-reference" | ||
} | ||
}, | ||
parameters: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/parameter-or-reference" | ||
} | ||
}, | ||
examples: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/example-or-reference" | ||
} | ||
}, | ||
requestBodies: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/request-body-or-reference" | ||
} | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/header-or-reference" | ||
} | ||
}, | ||
securitySchemes: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/security-scheme-or-reference" | ||
} | ||
}, | ||
links: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/link-or-reference" | ||
} | ||
}, | ||
callbacks: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/callbacks-or-reference" | ||
} | ||
}, | ||
pathItems: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/path-item-or-reference" | ||
} | ||
} | ||
}, | ||
patternProperties: { | ||
"^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$": { | ||
$comment: "Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected", | ||
propertyNames: { | ||
pattern: "^[a-zA-Z0-9._-]+$" | ||
} | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
paths: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#paths-object", | ||
type: "object", | ||
patternProperties: { | ||
"^/": { | ||
$ref: "#/$defs/path-item" | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"path-item": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#path-item-object", | ||
type: "object", | ||
properties: { | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/server" | ||
} | ||
}, | ||
parameters: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/parameter-or-reference" | ||
} | ||
}, | ||
get: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
put: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
post: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
"delete": { | ||
$ref: "#/$defs/operation" | ||
}, | ||
options: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
head: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
patch: { | ||
$ref: "#/$defs/operation" | ||
}, | ||
trace: { | ||
$ref: "#/$defs/operation" | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"path-item-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/path-item" | ||
} | ||
}, | ||
operation: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#operation-object", | ||
type: "object", | ||
properties: { | ||
tags: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
} | ||
}, | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
externalDocs: { | ||
$ref: "#/$defs/external-documentation" | ||
}, | ||
operationId: { | ||
type: "string" | ||
}, | ||
parameters: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/parameter-or-reference" | ||
} | ||
}, | ||
requestBody: { | ||
$ref: "#/$defs/request-body-or-reference" | ||
}, | ||
responses: { | ||
$ref: "#/$defs/responses" | ||
}, | ||
callbacks: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/callbacks-or-reference" | ||
} | ||
}, | ||
deprecated: { | ||
"default": false, | ||
type: "boolean" | ||
}, | ||
security: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/security-requirement" | ||
} | ||
}, | ||
servers: { | ||
type: "array", | ||
items: { | ||
$ref: "#/$defs/server" | ||
} | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"external-documentation": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#external-documentation-object", | ||
type: "object", | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
url: { | ||
type: "string", | ||
format: "uri" | ||
} | ||
}, | ||
required: [ | ||
"url" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
parameter: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#parameter-object", | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
"in": { | ||
"enum": [ | ||
"query", | ||
"header", | ||
"path", | ||
"cookie" | ||
] | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
required: { | ||
"default": false, | ||
type: "boolean" | ||
}, | ||
deprecated: { | ||
"default": false, | ||
type: "boolean" | ||
}, | ||
schema: { | ||
$ref: "#/$defs/schema" | ||
}, | ||
content: { | ||
$ref: "#/$defs/content", | ||
minProperties: 1, | ||
maxProperties: 1 | ||
} | ||
}, | ||
required: [ | ||
"name", | ||
"in" | ||
], | ||
oneOf: [ | ||
{ | ||
required: [ | ||
"schema" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"content" | ||
] | ||
} | ||
], | ||
"if": { | ||
properties: { | ||
"in": { | ||
"const": "query" | ||
} | ||
}, | ||
required: [ | ||
"in" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
allowEmptyValue: { | ||
"default": false, | ||
type: "boolean" | ||
} | ||
} | ||
}, | ||
dependentSchemas: { | ||
schema: { | ||
properties: { | ||
style: { | ||
type: "string" | ||
}, | ||
explode: { | ||
type: "boolean" | ||
} | ||
}, | ||
allOf: [ | ||
{ | ||
$ref: "#/$defs/examples" | ||
}, | ||
{ | ||
$ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path" | ||
}, | ||
{ | ||
$ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header" | ||
}, | ||
{ | ||
$ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query" | ||
}, | ||
{ | ||
$ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie" | ||
}, | ||
{ | ||
$ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form" | ||
} | ||
], | ||
$defs: { | ||
"styles-for-path": { | ||
"if": { | ||
properties: { | ||
"in": { | ||
"const": "path" | ||
} | ||
}, | ||
required: [ | ||
"in" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
name: { | ||
pattern: "[^/#?]+$" | ||
}, | ||
style: { | ||
"default": "simple", | ||
"enum": [ | ||
"matrix", | ||
"label", | ||
"simple" | ||
] | ||
}, | ||
required: { | ||
"const": true | ||
} | ||
}, | ||
required: [ | ||
"required" | ||
] | ||
} | ||
}, | ||
"styles-for-header": { | ||
"if": { | ||
properties: { | ||
"in": { | ||
"const": "header" | ||
} | ||
}, | ||
required: [ | ||
"in" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
style: { | ||
"default": "simple", | ||
"const": "simple" | ||
} | ||
} | ||
} | ||
}, | ||
"styles-for-query": { | ||
"if": { | ||
properties: { | ||
"in": { | ||
"const": "query" | ||
} | ||
}, | ||
required: [ | ||
"in" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
style: { | ||
"default": "form", | ||
"enum": [ | ||
"form", | ||
"spaceDelimited", | ||
"pipeDelimited", | ||
"deepObject" | ||
] | ||
}, | ||
allowReserved: { | ||
"default": false, | ||
type: "boolean" | ||
} | ||
} | ||
} | ||
}, | ||
"styles-for-cookie": { | ||
"if": { | ||
properties: { | ||
"in": { | ||
"const": "cookie" | ||
} | ||
}, | ||
required: [ | ||
"in" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
style: { | ||
"default": "form", | ||
"const": "form" | ||
} | ||
} | ||
} | ||
}, | ||
"styles-for-form": { | ||
"if": { | ||
properties: { | ||
style: { | ||
"const": "form" | ||
} | ||
}, | ||
required: [ | ||
"style" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
explode: { | ||
"default": true | ||
} | ||
} | ||
}, | ||
"else": { | ||
properties: { | ||
explode: { | ||
"default": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"parameter-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/parameter" | ||
} | ||
}, | ||
"request-body": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#request-body-object", | ||
type: "object", | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
content: { | ||
$ref: "#/$defs/content" | ||
}, | ||
required: { | ||
"default": false, | ||
type: "boolean" | ||
} | ||
}, | ||
required: [ | ||
"content" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"request-body-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/request-body" | ||
} | ||
}, | ||
content: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#fixed-fields-10", | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/media-type" | ||
}, | ||
propertyNames: { | ||
format: "media-range" | ||
} | ||
}, | ||
"media-type": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#media-type-object", | ||
type: "object", | ||
properties: { | ||
schema: { | ||
$ref: "#/$defs/schema" | ||
}, | ||
encoding: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/encoding" | ||
} | ||
} | ||
}, | ||
allOf: [ | ||
{ | ||
$ref: "#/$defs/specification-extensions" | ||
}, | ||
{ | ||
$ref: "#/$defs/examples" | ||
} | ||
], | ||
unevaluatedProperties: false | ||
}, | ||
encoding: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#encoding-object", | ||
type: "object", | ||
properties: { | ||
contentType: { | ||
type: "string", | ||
format: "media-range" | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/header-or-reference" | ||
} | ||
}, | ||
style: { | ||
"default": "form", | ||
"enum": [ | ||
"form", | ||
"spaceDelimited", | ||
"pipeDelimited", | ||
"deepObject" | ||
] | ||
}, | ||
explode: { | ||
type: "boolean" | ||
}, | ||
allowReserved: { | ||
"default": false, | ||
type: "boolean" | ||
} | ||
}, | ||
allOf: [ | ||
{ | ||
$ref: "#/$defs/specification-extensions" | ||
}, | ||
{ | ||
$ref: "#/$defs/encoding/$defs/explode-default" | ||
} | ||
], | ||
unevaluatedProperties: false, | ||
$defs: { | ||
"explode-default": { | ||
"if": { | ||
properties: { | ||
style: { | ||
"const": "form" | ||
} | ||
}, | ||
required: [ | ||
"style" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
explode: { | ||
"default": true | ||
} | ||
} | ||
}, | ||
"else": { | ||
properties: { | ||
explode: { | ||
"default": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
responses: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#responses-object", | ||
type: "object", | ||
properties: { | ||
"default": { | ||
$ref: "#/$defs/response-or-reference" | ||
} | ||
}, | ||
patternProperties: { | ||
"^[1-5](?:[0-9]{2}|XX)$": { | ||
$ref: "#/$defs/response-or-reference" | ||
} | ||
}, | ||
minProperties: 1, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
response: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#response-object", | ||
type: "object", | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
headers: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/header-or-reference" | ||
} | ||
}, | ||
content: { | ||
$ref: "#/$defs/content" | ||
}, | ||
links: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/link-or-reference" | ||
} | ||
} | ||
}, | ||
required: [ | ||
"description" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"response-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/response" | ||
} | ||
}, | ||
callbacks: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#callback-object", | ||
type: "object", | ||
$ref: "#/$defs/specification-extensions", | ||
additionalProperties: { | ||
$ref: "#/$defs/path-item-or-reference" | ||
} | ||
}, | ||
"callbacks-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/callbacks" | ||
} | ||
}, | ||
example: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#example-object", | ||
type: "object", | ||
properties: { | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
value: true, | ||
externalValue: { | ||
type: "string", | ||
format: "uri" | ||
} | ||
}, | ||
not: { | ||
required: [ | ||
"value", | ||
"externalValue" | ||
] | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"example-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/example" | ||
} | ||
}, | ||
link: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#link-object", | ||
type: "object", | ||
properties: { | ||
operationRef: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
operationId: { | ||
type: "string" | ||
}, | ||
parameters: { | ||
$ref: "#/$defs/map-of-strings" | ||
}, | ||
requestBody: true, | ||
description: { | ||
type: "string" | ||
}, | ||
body: { | ||
$ref: "#/$defs/server" | ||
} | ||
}, | ||
oneOf: [ | ||
{ | ||
required: [ | ||
"operationRef" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"operationId" | ||
] | ||
} | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"link-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/link" | ||
} | ||
}, | ||
header: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#header-object", | ||
type: "object", | ||
properties: { | ||
description: { | ||
type: "string" | ||
}, | ||
required: { | ||
"default": false, | ||
type: "boolean" | ||
}, | ||
deprecated: { | ||
"default": false, | ||
type: "boolean" | ||
}, | ||
schema: { | ||
$ref: "#/$defs/schema" | ||
}, | ||
content: { | ||
$ref: "#/$defs/content", | ||
minProperties: 1, | ||
maxProperties: 1 | ||
} | ||
}, | ||
oneOf: [ | ||
{ | ||
required: [ | ||
"schema" | ||
] | ||
}, | ||
{ | ||
required: [ | ||
"content" | ||
] | ||
} | ||
], | ||
dependentSchemas: { | ||
schema: { | ||
properties: { | ||
style: { | ||
"default": "simple", | ||
"const": "simple" | ||
}, | ||
explode: { | ||
"default": false, | ||
type: "boolean" | ||
} | ||
}, | ||
$ref: "#/$defs/examples" | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"header-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/header" | ||
} | ||
}, | ||
tag: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#tag-object", | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
}, | ||
externalDocs: { | ||
$ref: "#/$defs/external-documentation" | ||
} | ||
}, | ||
required: [ | ||
"name" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
reference: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#reference-object", | ||
type: "object", | ||
properties: { | ||
$ref: { | ||
type: "string", | ||
format: "uri-reference" | ||
}, | ||
summary: { | ||
type: "string" | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
unevaluatedProperties: false | ||
}, | ||
schema: { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#schema-object", | ||
$dynamicAnchor: "meta", | ||
type: [ | ||
"object", | ||
"boolean" | ||
] | ||
}, | ||
"security-scheme": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#security-scheme-object", | ||
type: "object", | ||
properties: { | ||
type: { | ||
"enum": [ | ||
"apiKey", | ||
"http", | ||
"mutualTLS", | ||
"oauth2", | ||
"openIdConnect" | ||
] | ||
}, | ||
description: { | ||
type: "string" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
], | ||
allOf: [ | ||
{ | ||
$ref: "#/$defs/specification-extensions" | ||
}, | ||
{ | ||
$ref: "#/$defs/security-scheme/$defs/type-apikey" | ||
}, | ||
{ | ||
$ref: "#/$defs/security-scheme/$defs/type-http" | ||
}, | ||
{ | ||
$ref: "#/$defs/security-scheme/$defs/type-http-bearer" | ||
}, | ||
{ | ||
$ref: "#/$defs/security-scheme/$defs/type-oauth2" | ||
}, | ||
{ | ||
$ref: "#/$defs/security-scheme/$defs/type-oidc" | ||
} | ||
], | ||
unevaluatedProperties: false, | ||
$defs: { | ||
"type-apikey": { | ||
"if": { | ||
properties: { | ||
type: { | ||
"const": "apiKey" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
"in": { | ||
"enum": [ | ||
"query", | ||
"header", | ||
"cookie" | ||
] | ||
} | ||
}, | ||
required: [ | ||
"name", | ||
"in" | ||
] | ||
} | ||
}, | ||
"type-http": { | ||
"if": { | ||
properties: { | ||
type: { | ||
"const": "http" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
scheme: { | ||
type: "string" | ||
} | ||
}, | ||
required: [ | ||
"scheme" | ||
] | ||
} | ||
}, | ||
"type-http-bearer": { | ||
"if": { | ||
properties: { | ||
type: { | ||
"const": "http" | ||
}, | ||
scheme: { | ||
type: "string", | ||
pattern: "^[Bb][Ee][Aa][Rr][Ee][Rr]$" | ||
} | ||
}, | ||
required: [ | ||
"type", | ||
"scheme" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
bearerFormat: { | ||
type: "string" | ||
} | ||
} | ||
} | ||
}, | ||
"type-oauth2": { | ||
"if": { | ||
properties: { | ||
type: { | ||
"const": "oauth2" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
flows: { | ||
$ref: "#/$defs/oauth-flows" | ||
} | ||
}, | ||
required: [ | ||
"flows" | ||
] | ||
} | ||
}, | ||
"type-oidc": { | ||
"if": { | ||
properties: { | ||
type: { | ||
"const": "openIdConnect" | ||
} | ||
}, | ||
required: [ | ||
"type" | ||
] | ||
}, | ||
then: { | ||
properties: { | ||
openIdConnectUrl: { | ||
type: "string", | ||
format: "uri" | ||
} | ||
}, | ||
required: [ | ||
"openIdConnectUrl" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"security-scheme-or-reference": { | ||
"if": { | ||
type: "object", | ||
required: [ | ||
"$ref" | ||
] | ||
}, | ||
then: { | ||
$ref: "#/$defs/reference" | ||
}, | ||
"else": { | ||
$ref: "#/$defs/security-scheme" | ||
} | ||
}, | ||
"oauth-flows": { | ||
type: "object", | ||
properties: { | ||
implicit: { | ||
$ref: "#/$defs/oauth-flows/$defs/implicit" | ||
}, | ||
password: { | ||
$ref: "#/$defs/oauth-flows/$defs/password" | ||
}, | ||
clientCredentials: { | ||
$ref: "#/$defs/oauth-flows/$defs/client-credentials" | ||
}, | ||
authorizationCode: { | ||
$ref: "#/$defs/oauth-flows/$defs/authorization-code" | ||
} | ||
}, | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false, | ||
$defs: { | ||
implicit: { | ||
type: "object", | ||
properties: { | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
scopes: { | ||
$ref: "#/$defs/map-of-strings" | ||
} | ||
}, | ||
required: [ | ||
"authorizationUrl", | ||
"scopes" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
password: { | ||
type: "object", | ||
properties: { | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
scopes: { | ||
$ref: "#/$defs/map-of-strings" | ||
} | ||
}, | ||
required: [ | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"client-credentials": { | ||
type: "object", | ||
properties: { | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
scopes: { | ||
$ref: "#/$defs/map-of-strings" | ||
} | ||
}, | ||
required: [ | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
}, | ||
"authorization-code": { | ||
type: "object", | ||
properties: { | ||
authorizationUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
tokenUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
refreshUrl: { | ||
type: "string", | ||
format: "uri" | ||
}, | ||
scopes: { | ||
$ref: "#/$defs/map-of-strings" | ||
} | ||
}, | ||
required: [ | ||
"authorizationUrl", | ||
"tokenUrl", | ||
"scopes" | ||
], | ||
$ref: "#/$defs/specification-extensions", | ||
unevaluatedProperties: false | ||
} | ||
} | ||
}, | ||
"security-requirement": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#security-requirement-object", | ||
type: "object", | ||
additionalProperties: { | ||
type: "array", | ||
items: { | ||
type: "string" | ||
} | ||
} | ||
}, | ||
"specification-extensions": { | ||
$comment: "https://spec.openapis.org/oas/v3.1.0#specification-extensions", | ||
patternProperties: { | ||
"^x-": true | ||
} | ||
}, | ||
examples: { | ||
properties: { | ||
example: true, | ||
examples: { | ||
type: "object", | ||
additionalProperties: { | ||
$ref: "#/$defs/example-or-reference" | ||
} | ||
} | ||
} | ||
}, | ||
"map-of-strings": { | ||
type: "object", | ||
additionalProperties: { | ||
type: "string" | ||
} | ||
} | ||
}; | ||
var OpenApi31 = { | ||
$id: $id, | ||
$schema: $schema, | ||
description: description, | ||
type: type, | ||
properties: properties, | ||
required: required, | ||
anyOf: anyOf, | ||
$ref: $ref, | ||
unevaluatedProperties: unevaluatedProperties, | ||
$defs: $defs | ||
}; | ||
export { $defs, $id, $ref, $schema, anyOf, OpenApi31 as default, description, properties, required, type, unevaluatedProperties }; |
@@ -1,1 +0,108 @@ | ||
import{getErrors as r,isRequiredError as e,isAnyOfError as t,isEnumError as n,getSiblings as o,notUndefined as a,concatAll as i,getChildren as c}from"./utils.js";import s from"./validation-errors/additional-prop.js";import d from"./validation-errors/default.js";import l from"./validation-errors/enum.js";import u from"./validation-errors/pattern.js";import h from"./validation-errors/required.js";import m from"./validation-errors/unevaluated-prop.js";const p=/\/[\w_-]+(\/\d+)?/g;function f(r=[]){const e={children:{}};return r.forEach((r=>{const t=void 0!==r.instancePath?r.instancePath:r.dataPath,n=""===t?[""]:t.match(p);n&&n.reduce(((e,t,o)=>(e.children[t]=e.children[t]||{children:{},errors:[]},o===n.length-1&&e.children[t].errors.push(r),e.children[t])),e)})),e}function w(i,c,s){r(i).forEach((r=>{e(r)&&(i.errors=[r],i.children={})})),r(i).some(t)&&Object.keys(i.children).length>0&&delete i.errors,i.errors?.length&&r(i).every(n)&&o(c)(i).filter(a).some(r)&&delete c.children[s],Object.entries(i.children).forEach((([r,e])=>w(e,i,r)))}function v(e,t){const o=r(e);if(o.length&&o.every(n)){const r=[...new Set(i([])(o.map((r=>r.params.allowedValues))))],e=o[0];return[new l({...e,params:{allowedValues:r}},t)]}return i(o.reduce(((r,e)=>{switch(e.keyword){case"additionalProperties":return r.concat(new s(e,t));case"pattern":return r.concat(new u(e,t));case"required":return r.concat(new h(e,t));case"unevaluatedProperties":return r.concat(new m(e,t));default:return r.concat(new d(e,t))}}),[]))(c(e).map((r=>v(r,t))))}function j(r,e){const t=f(r||[]);return w(t),v(t,e)}export{v as createErrorInstances,j as default,w as filterRedundantErrors,f as makeTree}; | ||
import { getErrors, isRequiredError, isAnyOfError, isEnumError, getSiblings, notUndefined, concatAll, getChildren } from './utils.js'; | ||
import EnumValidationError from './validation-errors/enum.js'; | ||
import DefaultValidationError from './validation-errors/default.js'; | ||
import UnevaluatedPropValidationError from './validation-errors/unevaluated-prop.js'; | ||
import RequiredValidationError from './validation-errors/required.js'; | ||
import PatternValidationError from './validation-errors/pattern.js'; | ||
import AdditionalPropValidationError from './validation-errors/additional-prop.js'; | ||
/* eslint-disable no-param-reassign */ | ||
const JSON_POINTERS_REGEX = /\/[\w_-]+(\/\d+)?/g; | ||
// Make a tree of errors from ajv errors array | ||
function makeTree(ajvErrors = []) { | ||
const root = { children: {} }; | ||
ajvErrors.forEach((ajvError) => { | ||
const instancePath = typeof ajvError.instancePath !== 'undefined' | ||
? ajvError.instancePath | ||
: ajvError.dataPath; | ||
// `dataPath === ''` is root | ||
const paths = instancePath === '' ? [''] : instancePath.match(JSON_POINTERS_REGEX); | ||
if (paths) { | ||
paths.reduce((obj, path, i) => { | ||
obj.children[path] = obj.children[path] || { children: {}, errors: [] }; | ||
if (i === paths.length - 1) { | ||
obj.children[path].errors.push(ajvError); | ||
} | ||
return obj.children[path]; | ||
}, root); | ||
} | ||
}); | ||
return root; | ||
} | ||
function filterRedundantErrors(root, parent, key) { | ||
/** | ||
* If there is a `required` error then we can just skip everythig else. | ||
* And, also `required` should have more priority than `anyOf`. @see #8 | ||
*/ | ||
getErrors(root).forEach((error) => { | ||
if (isRequiredError(error)) { | ||
root.errors = [error]; | ||
root.children = {}; | ||
} | ||
}); | ||
/** | ||
* If there is an `anyOf` error that means we have more meaningful errors | ||
* inside children. So we will just remove all errors from this level. | ||
* | ||
* If there are no children, then we don't delete the errors since we should | ||
* have at least one error to report. | ||
*/ | ||
if (getErrors(root).some(isAnyOfError)) { | ||
if (Object.keys(root.children).length > 0) { | ||
delete root.errors; | ||
} | ||
} | ||
/** | ||
* If all errors are `enum` and siblings have any error then we can safely | ||
* ignore the node. | ||
* | ||
* **CAUTION** | ||
* Need explicit `root.errors` check because `[].every(fn) === true` | ||
* https://en.wikipedia.org/wiki/Vacuous_truth#Vacuous_truths_in_mathematics | ||
*/ | ||
if (root.errors?.length && getErrors(root).every(isEnumError)) { | ||
if (getSiblings(parent)(root) | ||
// Remove any reference which becomes `undefined` later | ||
.filter(notUndefined) | ||
.some(getErrors)) { | ||
delete parent.children[key]; | ||
} | ||
} | ||
Object.entries(root.children).forEach(([k, child]) => filterRedundantErrors(child, root, k)); | ||
} | ||
function createErrorInstances(root, options) { | ||
const errors = getErrors(root); | ||
if (errors.length && errors.every(isEnumError)) { | ||
const uniqueValues = new Set(concatAll([])(errors.map((e) => e.params.allowedValues))); | ||
const allowedValues = [...uniqueValues]; | ||
const error = errors[0]; | ||
return [ | ||
new EnumValidationError({ | ||
...error, | ||
params: { allowedValues }, | ||
}, options), | ||
]; | ||
} | ||
return concatAll(errors.reduce((ret, error) => { | ||
switch (error.keyword) { | ||
case 'additionalProperties': | ||
return ret.concat(new AdditionalPropValidationError(error, options)); | ||
case 'pattern': | ||
return ret.concat(new PatternValidationError(error, options)); | ||
case 'required': | ||
return ret.concat(new RequiredValidationError(error, options)); | ||
case 'unevaluatedProperties': | ||
return ret.concat(new UnevaluatedPropValidationError(error, options)); | ||
default: | ||
return ret.concat(new DefaultValidationError(error, options)); | ||
} | ||
}, []))(getChildren(root).map((child) => createErrorInstances(child, options))); | ||
} | ||
function prettify(ajvErrors, options) { | ||
const tree = makeTree(ajvErrors || []); | ||
// @ts-expect-error TODO | ||
filterRedundantErrors(tree); | ||
return createErrorInstances(tree, options); | ||
} | ||
export { createErrorInstances, prettify as default, filterRedundantErrors, makeTree }; |
@@ -1,1 +0,15 @@ | ||
import n from"./helpers.js";function r(r,t,o,e={}){const{indent:l=null,json:s=null}=e,a=s||JSON.stringify(t,null,l);return n(o,{data:t,schema:r,jsonRaw:a}).map((n=>n.getError()))}export{r as betterAjvErrors}; | ||
import prettify from './helpers.js'; | ||
function betterAjvErrors(schema, data, errors, options = {}) { | ||
const { indent = null, json = null } = options; | ||
const jsonRaw = json || JSON.stringify(data, null, indent); | ||
const customErrorToStructure = (error) => error.getError(); | ||
const customErrors = prettify(errors, { | ||
data, | ||
schema, | ||
jsonRaw, | ||
}); | ||
return customErrors.map(customErrorToStructure); | ||
} | ||
export { betterAjvErrors }; |
@@ -1,1 +0,31 @@ | ||
const r=r=>void 0!==r,e=r=>e=>e.keyword===r,n=e("required"),t=e("anyOf"),c=e("enum"),o=r=>r&&r.errors||[],u=r=>{return r&&(e=r.children,Object.values(e))||[];var e},a=r=>e=>{return u(r).filter((t=e,n=r=>t===r,r=>!n(r)));var n,t},d=r=>e=>e.reduce(((r,e)=>r.concat(e)),r);export{d as concatAll,u as getChildren,o as getErrors,a as getSiblings,t as isAnyOfError,c as isEnumError,n as isRequiredError,r as notUndefined}; | ||
// Basic | ||
const eq = (x) => (y) => x === y; | ||
const not = (fn) => (x) => !fn(x); | ||
const getValues = (o) => Object.values(o); | ||
const notUndefined = (x) => x !== undefined; | ||
// Error | ||
const isXError = (x) => (error) => error.keyword === x; | ||
const isRequiredError = isXError('required'); | ||
const isAnyOfError = isXError('anyOf'); | ||
const isEnumError = isXError('enum'); | ||
const getErrors = (node) => (node && node.errors) || []; | ||
// Node | ||
const getChildren = (node) => (node && getValues(node.children)) || []; | ||
const getSiblings = | ||
(parent /*: Node */) => (node /*: Node */) /*: $ReadOnlyArray<Node> */ => | ||
getChildren(parent).filter(not(eq(node))); | ||
const concatAll = | ||
/* ::<T> */ | ||
(xs /*: $ReadOnlyArray<T> */) => | ||
(ys /* : $ReadOnlyArray<T> */) /* : $ReadOnlyArray<T> */ => | ||
ys.reduce((zs, z) => zs.concat(z), xs); | ||
export { concatAll, getChildren, getErrors, getSiblings, isAnyOfError, isEnumError, isRequiredError, notUndefined }; |
@@ -1,1 +0,20 @@ | ||
import t from"./base.js";class e extends t{constructor(...t){super(...t),this.name="AdditionalPropValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t}=this.options;return{message:`Property ${t.additionalProperty} is not expected to be here`,path:this.instancePath}}}export{e as default}; | ||
import BaseValidationError from './base.js'; | ||
class AdditionalPropValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'AdditionalPropValidationError'; | ||
this.options.isIdentifierLocation = true; | ||
} | ||
getError() { | ||
const { params } = this.options; | ||
return { | ||
message: `Property ${params.additionalProperty} is not expected to be here`, | ||
path: this.instancePath, | ||
} | ||
} | ||
} | ||
export { AdditionalPropValidationError as default }; |
@@ -1,1 +0,34 @@ | ||
class t{constructor(t={isIdentifierLocation:!1},{data:s,schema:o,jsonAst:i,jsonRaw:n}){this.options=t,this.data=s,this.schema=o,this.jsonAst=i,this.jsonRaw=n}get instancePath(){return void 0!==this.options.instancePath?this.options.instancePath:this.options.dataPath}getError(){throw new Error(`Implement the 'getError' method inside ${this.constructor.name}!`)}}export{t as default}; | ||
// import { codeFrameColumns } from '@babel/code-frame'; | ||
// import chalk from 'chalk'; | ||
// import { getMetaFromPath } from '../json/index' | ||
class BaseValidationError { | ||
// eslint-disable-next-line default-param-last | ||
constructor( | ||
options = { isIdentifierLocation: false }, | ||
{ data, schema, jsonAst, jsonRaw }, | ||
) { | ||
this.options = options; | ||
this.data = data; | ||
this.schema = schema; | ||
this.jsonAst = jsonAst; | ||
this.jsonRaw = jsonRaw; | ||
} | ||
/** | ||
* @return {string} | ||
*/ | ||
get instancePath() { | ||
return typeof this.options.instancePath !== 'undefined' | ||
? this.options.instancePath | ||
: this.options.dataPath | ||
} | ||
getError() { | ||
throw new Error( | ||
`Implement the 'getError' method inside ${this.constructor.name}!`, | ||
) | ||
} | ||
} | ||
export { BaseValidationError as default }; |
@@ -1,1 +0,20 @@ | ||
import s from"./base.js";class t extends s{constructor(...s){super(...s),this.name="DefaultValidationError",this.options.isSkipEndLocation=!0}getError(){const{keyword:s,message:t}=this.options;return{message:`${s} ${t}`,path:this.instancePath}}}export{t as default}; | ||
import BaseValidationError from './base.js'; | ||
class DefaultValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'DefaultValidationError'; | ||
this.options.isSkipEndLocation = true; | ||
} | ||
getError() { | ||
const { keyword, message } = this.options; | ||
return { | ||
message: `${keyword} ${message}`, | ||
path: this.instancePath, | ||
} | ||
} | ||
} | ||
export { DefaultValidationError as default }; |
@@ -1,1 +0,58 @@ | ||
import t from"jsonpointer";import e from"leven";import s from"./base.js";class a extends s{constructor(...t){super(...t),this.name="EnumValidationError"}getError(){const{message:t,params:e}=this.options,s=this.findBestMatch(),a={message:`${t}: ${e.allowedValues.join(", ")}`,path:this.instancePath};return null!==s&&(a.suggestion=`Did you mean ${s}?`),a}findBestMatch(){const{params:{allowedValues:s}}=this.options,a=""===this.instancePath?this.data:t.get(this.data,this.instancePath);if(!a)return null;const i=s.map((t=>({value:t,weight:e(t,a.toString())}))).sort(((t,e)=>t.weight>e.weight?1:t.weight<e.weight?-1:0))[0];return 1===s.length||i.weight<i.value.length?i.value:null}}export{a as default}; | ||
import pointer from 'jsonpointer'; | ||
import leven from 'leven'; | ||
import BaseValidationError from './base.js'; | ||
class EnumValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'EnumValidationError'; | ||
} | ||
getError() { | ||
const { message, params } = this.options; | ||
const bestMatch = this.findBestMatch(); | ||
const allowedValues = params.allowedValues.join(', '); | ||
const output = { | ||
message: `${message}: ${allowedValues}`, | ||
path: this.instancePath, | ||
}; | ||
if (bestMatch !== null) { | ||
output.suggestion = `Did you mean ${bestMatch}?`; | ||
} | ||
return output | ||
} | ||
findBestMatch() { | ||
const { | ||
params: { allowedValues }, | ||
} = this.options; | ||
const currentValue = | ||
this.instancePath === '' | ||
? this.data | ||
: pointer.get(this.data, this.instancePath); | ||
if (!currentValue) { | ||
return null | ||
} | ||
const bestMatch = allowedValues | ||
.map((value) => ({ | ||
value, | ||
weight: leven(value, currentValue.toString()), | ||
})) | ||
.sort((x, y) => | ||
x.weight > y.weight ? 1 : x.weight < y.weight ? -1 : 0, | ||
)[0]; | ||
return allowedValues.length === 1 || | ||
bestMatch.weight < bestMatch.value.length | ||
? bestMatch.value | ||
: null | ||
} | ||
} | ||
export { EnumValidationError as default }; |
@@ -1,1 +0,20 @@ | ||
import t from"./base.js";class r extends t{constructor(...t){super(...t),this.name="PatternValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t,propertyName:r}=this.options;return{message:`Property "${r}" must match pattern ${t.pattern}`,path:this.instancePath}}}export{r as default}; | ||
import BaseValidationError from './base.js'; | ||
class PatternValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'PatternValidationError'; | ||
this.options.isIdentifierLocation = true; | ||
} | ||
getError() { | ||
const { params, propertyName } = this.options; | ||
return { | ||
message: `Property "${propertyName}" must match pattern ${params.pattern}`, | ||
path: this.instancePath, | ||
} | ||
} | ||
} | ||
export { PatternValidationError as default }; |
@@ -1,1 +0,19 @@ | ||
import s from"./base.js";class t extends s{constructor(...s){super(...s),this.name="RequiredValidationError"}getError(){const{message:s}=this.options;return{message:`${s}`,path:this.instancePath}}}export{t as default}; | ||
import BaseValidationError from './base.js'; | ||
class RequiredValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'RequiredValidationError'; | ||
} | ||
getError() { | ||
const { message } = this.options; | ||
return { | ||
message: `${message}`, | ||
path: this.instancePath, | ||
} | ||
} | ||
} | ||
export { RequiredValidationError as default }; |
@@ -1,1 +0,20 @@ | ||
import t from"./base.js";class e extends t{constructor(...t){super(...t),this.name="UnevaluatedPropValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t}=this.options;return{message:`Property ${t.unevaluatedProperty} is not expected to be here`,path:this.instancePath}}}export{e as default}; | ||
import BaseValidationError from './base.js'; | ||
class UnevaluatedPropValidationError extends BaseValidationError { | ||
constructor(...args) { | ||
super(...args); | ||
this.name = 'UnevaluatedPropValidationError'; | ||
this.options.isIdentifierLocation = true; | ||
} | ||
getError() { | ||
const { params } = this.options; | ||
return { | ||
message: `Property ${params.unevaluatedProperty} is not expected to be here`, | ||
path: this.instancePath, | ||
} | ||
} | ||
} | ||
export { UnevaluatedPropValidationError as default }; |
@@ -1,1 +0,21 @@ | ||
import{details as e}from"./details.js";import{getEntrypoint as r}from"./getEntrypoint.js";import{makeFilesystem as o}from"./makeFilesystem.js";import{resolveReferences as s}from"./resolveReferences.js";async function i(i,t){const c=o(i),m=r(c),n=s(c,t);return{specification:m.specification,errors:n.errors,schema:n.schema,...e(m.specification)}}export{i as dereference}; | ||
import { details } from './details.js'; | ||
import { getEntrypoint } from './getEntrypoint.js'; | ||
import { makeFilesystem } from './makeFilesystem.js'; | ||
import { resolveReferences } from './resolveReferences.js'; | ||
/** | ||
* Validates an OpenAPI schema and resolves all references. | ||
*/ | ||
async function dereference(value, options) { | ||
const filesystem = makeFilesystem(value); | ||
const entrypoint = getEntrypoint(filesystem); | ||
const result = resolveReferences(filesystem, options); | ||
return { | ||
specification: entrypoint.specification, | ||
errors: result.errors, | ||
schema: result.schema, | ||
...details(entrypoint.specification), | ||
}; | ||
} | ||
export { dereference }; |
@@ -1,1 +0,25 @@ | ||
import{OpenApiVersions as i}from"../configuration/index.js";function o(o){for(const n of new Set(i)){const i="2.0"===n?"swagger":"openapi",e=o[i];if("string"==typeof e&&e.startsWith(n))return{version:n,specificationType:i,specificationVersion:e}}return{version:void 0,specificationType:void 0,specificationVersion:void 0}}export{o as details}; | ||
import { OpenApiVersions } from '../configuration/index.js'; | ||
/** | ||
* Get versions of the OpenAPI specification. | ||
*/ | ||
function details(specification) { | ||
for (const version of new Set(OpenApiVersions)) { | ||
const specificationType = version === '2.0' ? 'swagger' : 'openapi'; | ||
const value = specification[specificationType]; | ||
if (typeof value === 'string' && value.startsWith(version)) { | ||
return { | ||
version: version, | ||
specificationType, | ||
specificationVersion: value, | ||
}; | ||
} | ||
} | ||
return { | ||
version: undefined, | ||
specificationType: undefined, | ||
specificationVersion: undefined, | ||
}; | ||
} | ||
export { details }; |
@@ -1,1 +0,10 @@ | ||
function e(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}export{e as escapeJsonPointer}; | ||
/** | ||
* Escapes a JSON pointer string. | ||
* | ||
* Example: `/foo/bar~baz` -> `/foo~1bar~0baz` | ||
*/ | ||
function escapeJsonPointer(str) { | ||
return str.replace(/~/g, '~0').replace(/\//g, '~1'); | ||
} | ||
export { escapeJsonPointer }; |
@@ -1,1 +0,17 @@ | ||
import{getEntrypoint as t}from"./getEntrypoint.js";import{makeFilesystem as i}from"./makeFilesystem.js";import{traverse as o}from"./traverse.js";function r(r,e){const s=i(r);return{specification:o(t(s).specification,(t=>e(t)?t:void 0))}}export{r as filter}; | ||
import { getEntrypoint } from './getEntrypoint.js'; | ||
import { makeFilesystem } from './makeFilesystem.js'; | ||
import { traverse } from './traverse.js'; | ||
/** | ||
* Filter the specification based on the callback | ||
*/ | ||
function filter(specification, callback) { | ||
const filesystem = makeFilesystem(specification); | ||
return { | ||
specification: traverse(getEntrypoint(filesystem).specification, (schema) => { | ||
return callback(schema) ? schema : undefined; | ||
}), | ||
}; | ||
} | ||
export { filter }; |
@@ -1,1 +0,8 @@ | ||
function n(n){return n?.find((n=>n.isEntrypoint))}export{n as getEntrypoint}; | ||
/** | ||
* Return just the entrypoint of the filesystem. | ||
*/ | ||
function getEntrypoint(filesystem) { | ||
return filesystem?.find((file) => file.isEntrypoint); | ||
} | ||
export { getEntrypoint }; |
@@ -1,1 +0,27 @@ | ||
import{traverse as t}from"./traverse.js";function e(e){const r=[];return e&&"object"==typeof e?(t(e,(t=>(t.$ref&&"string"==typeof t.$ref&&!t.$ref.startsWith("#")&&r.push(t.$ref.split("#")[0]),t))),[...new Set(r)]):r}export{e as getListOfReferences}; | ||
import { traverse } from './traverse.js'; | ||
/** | ||
* Walks through the specification and returns all references as an array. | ||
* | ||
* Warning: Doesn’t return internal references. | ||
*/ | ||
function getListOfReferences(specification) { | ||
const references = []; | ||
// Make sure we’re dealing with an object | ||
if (!specification || typeof specification !== 'object') { | ||
return references; | ||
} | ||
// Traverse the specification and collect all references | ||
traverse(specification, (value) => { | ||
if (value.$ref && | ||
typeof value.$ref === 'string' && | ||
!value.$ref.startsWith('#')) { | ||
references.push(value.$ref.split('#')[0]); | ||
} | ||
return value; | ||
}); | ||
// Remove duplicates | ||
return [...new Set(references)]; | ||
} | ||
export { getListOfReferences }; |
@@ -1,1 +0,18 @@ | ||
import{unescapeJsonPointer as e}from"./unescapeJsonPointer.js";function n(n){return n.split("/").slice(1).map(e)}export{n as getSegmentsFromPath}; | ||
import { unescapeJsonPointer } from './unescapeJsonPointer.js'; | ||
/** | ||
* Translate `/paths/~1test` to `['paths', '/test']` | ||
*/ | ||
function getSegmentsFromPath(path) { | ||
return ( | ||
// /paths/~1test | ||
path | ||
// ['', 'paths', '~1test'] | ||
.split('/') | ||
// ['paths', '~test'] | ||
.slice(1) | ||
// ['paths', '/test'] | ||
.map(unescapeJsonPointer)); | ||
} | ||
export { getSegmentsFromPath }; |
@@ -1,1 +0,11 @@ | ||
function r(r){return void 0!==r&&Array.isArray(r)&&r.length>0&&r.some((r=>!0===r.isEntrypoint))}export{r as isFilesystem}; | ||
/** | ||
* Check if the value is a filesystem | ||
*/ | ||
function isFilesystem(value) { | ||
return (typeof value !== 'undefined' && | ||
Array.isArray(value) && | ||
value.length > 0 && | ||
value.some((file) => file.isEntrypoint === true)); | ||
} | ||
export { isFilesystem }; |
@@ -1,1 +0,11 @@ | ||
function r(r){try{return JSON.parse(r),!0}catch{return!1}}export{r as isJson}; | ||
function isJson(value) { | ||
try { | ||
JSON.parse(value); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
} | ||
export { isJson }; |
@@ -1,1 +0,6 @@ | ||
const r=r=>"object"==typeof r&&!Array.isArray(r)&&null!==r;export{r as isObject}; | ||
/** | ||
* Check if the given value is an object | ||
*/ | ||
const isObject = (obj) => typeof obj === 'object' && !Array.isArray(obj) && obj !== null; | ||
export { isObject }; |
@@ -1,1 +0,19 @@ | ||
import{parse as r}from"yaml";function t(t){if(!t.includes("\n"))return!1;try{return r(t,{maxAliasCount:1e4}),!0}catch(r){return!1}}export{t as isYaml}; | ||
import { parse } from 'yaml'; | ||
function isYaml(value) { | ||
// Line breaks | ||
if (!value.includes('\n')) { | ||
return false; | ||
} | ||
try { | ||
parse(value, { | ||
maxAliasCount: 10000, | ||
}); | ||
return true; | ||
} | ||
catch (error) { | ||
return false; | ||
} | ||
} | ||
export { isYaml }; |
@@ -1,1 +0,121 @@ | ||
import{ERRORS as e}from"../../configuration/index.js";import{getEntrypoint as i}from"../getEntrypoint.js";import{getListOfReferences as r}from"../getListOfReferences.js";import{makeFilesystem as s}from"../makeFilesystem.js";import{normalize as t}from"../normalize.js";async function n(o,f){const c=[];if(f?.filesystem?.find((e=>e.filename===o)))return{specification:i(f.filesystem)?.specification,filesystem:f.filesystem,errors:c};const l=f?.plugins?.find((e=>e.check(o)));let a;if(l)try{a=t(await l.get(o))}catch(i){if(f?.throwOnError)throw new Error(e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",o));return c.push({code:"EXTERNAL_REFERENCE_NOT_FOUND",message:e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",o)}),{specification:null,filesystem:[],errors:c}}else a=t(o);if(void 0===a){if(f?.throwOnError)throw new Error("No content to load");return c.push({code:"NO_CONTENT",message:e.NO_CONTENT}),{specification:null,filesystem:[],errors:c}}let m=s(a,{filename:f?.filename??null});const E=(f?.filename?m.find((e=>e.filename===f?.filename)):i(m)).references??r(a);if(0===E.length)return{specification:i(m)?.specification,filesystem:m,errors:c};for(const e of E){const i=f?.plugins?.find((i=>i.check(e)));if(!i)continue;const r=i.check(e)&&i.resolvePath?i.resolvePath(o,e):e;if(m.find((i=>i.filename===e)))continue;const{filesystem:s,errors:t}=await n(r,{...f,filename:e});c.push(...t),m=[...m,...s.map((e=>({...e,isEntrypoint:!1})))]}return{specification:i(m)?.specification,filesystem:m,errors:c}}export{n as load}; | ||
import { ERRORS } from '../../configuration/index.js'; | ||
import { getEntrypoint } from '../getEntrypoint.js'; | ||
import { getListOfReferences } from '../getListOfReferences.js'; | ||
import { makeFilesystem } from '../makeFilesystem.js'; | ||
import { normalize } from '../normalize.js'; | ||
/** | ||
* Loads an OpenAPI document, including any external references. | ||
* | ||
* This function handles loading content from various sources, normalizes the content, | ||
* and recursively loads any external references found within the definition. | ||
* | ||
* It builds a filesystem representation of all loaded content and collects any errors | ||
* encountered during the process. | ||
*/ | ||
async function load(value, options) { | ||
const errors = []; | ||
// Don’t load a reference twice, check the filesystem before fetching something | ||
if (options?.filesystem?.find((entry) => entry.filename === value)) { | ||
return { | ||
specification: getEntrypoint(options.filesystem)?.specification, | ||
filesystem: options.filesystem, | ||
errors, | ||
}; | ||
} | ||
// Check whether the value is an URL or file path | ||
const plugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(value)); | ||
let content; | ||
if (plugin) { | ||
try { | ||
content = normalize(await plugin.get(value)); | ||
} | ||
catch (error) { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value)); | ||
} | ||
errors.push({ | ||
code: 'EXTERNAL_REFERENCE_NOT_FOUND', | ||
message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value), | ||
}); | ||
return { | ||
specification: null, | ||
filesystem: [], | ||
errors, | ||
}; | ||
} | ||
} | ||
else { | ||
content = normalize(value); | ||
} | ||
// No content | ||
if (content === undefined) { | ||
if (options?.throwOnError) { | ||
throw new Error('No content to load'); | ||
} | ||
errors.push({ | ||
code: 'NO_CONTENT', | ||
message: ERRORS.NO_CONTENT, | ||
}); | ||
return { | ||
specification: null, | ||
filesystem: [], | ||
errors, | ||
}; | ||
} | ||
let filesystem = makeFilesystem(content, { | ||
filename: options?.filename ?? null, | ||
}); | ||
// Get references from file system entry, or from the content | ||
const newEntry = options?.filename | ||
? filesystem.find((entry) => entry.filename === options?.filename) | ||
: getEntrypoint(filesystem); | ||
const listOfReferences = newEntry.references ?? getListOfReferences(content); | ||
// No other references | ||
if (listOfReferences.length === 0) { | ||
return { | ||
specification: getEntrypoint(filesystem)?.specification, | ||
filesystem, | ||
errors, | ||
}; | ||
} | ||
// Load other external references | ||
for (const reference of listOfReferences) { | ||
// Find a matching plugin | ||
const otherPlugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(reference)); | ||
// Skip if no plugin is found (internal references don’t need a plugin for example) | ||
if (!otherPlugin) { | ||
continue; | ||
} | ||
const target = otherPlugin.check(reference) && otherPlugin.resolvePath | ||
? otherPlugin.resolvePath(value, reference) | ||
: reference; | ||
// Don’t load a reference twice, check the filesystem before fetching something | ||
if (filesystem.find((entry) => entry.filename === reference)) { | ||
continue; | ||
} | ||
const { filesystem: referencedFiles, errors: newErrors } = await load(target, { | ||
...options, | ||
// Make the filename the exact same value as the $ref | ||
// TODO: This leads to problems, if there are multiple references with the same file name but in different folders | ||
filename: reference, | ||
}); | ||
errors.push(...newErrors); | ||
filesystem = [ | ||
...filesystem, | ||
...referencedFiles.map((file) => { | ||
return { | ||
...file, | ||
isEntrypoint: false, | ||
}; | ||
}), | ||
]; | ||
} | ||
return { | ||
specification: getEntrypoint(filesystem)?.specification, | ||
filesystem, | ||
errors, | ||
}; | ||
} | ||
export { load }; |
@@ -1,1 +0,25 @@ | ||
import{getListOfReferences as e}from"./getListOfReferences.js";import{isFilesystem as r}from"./isFilesystem.js";import{normalize as i}from"./normalize.js";function t(t,n={}){if(r(t))return t;const o=i(t);return[{isEntrypoint:!0,specification:o,filename:null,dir:"./",references:e(o),...n}]}export{t as makeFilesystem}; | ||
import { getListOfReferences } from './getListOfReferences.js'; | ||
import { isFilesystem } from './isFilesystem.js'; | ||
import { normalize } from './normalize.js'; | ||
function makeFilesystem(value, overwrites = {}) { | ||
// Keep as is | ||
if (isFilesystem(value)) { | ||
return value; | ||
} | ||
// Make an object | ||
const specification = normalize(value); | ||
// Create fake filesystem | ||
return [ | ||
{ | ||
isEntrypoint: true, | ||
specification, | ||
filename: null, | ||
dir: './', | ||
references: getListOfReferences(specification), | ||
...overwrites, | ||
}, | ||
]; | ||
} | ||
export { makeFilesystem }; |
@@ -1,1 +0,25 @@ | ||
import{parse as r}from"yaml";import{isFilesystem as t}from"./isFilesystem.js";function e(e){if(t(e))return e;if("string"==typeof e)try{return JSON.parse(e)}catch(t){return r(e,{maxAliasCount:1e4})}return e}export{e as normalize}; | ||
import { parse } from 'yaml'; | ||
import { isFilesystem } from './isFilesystem.js'; | ||
/** | ||
* Normalize the OpenAPI specification to a JavaScript object. | ||
* Don’t touch the object if it’s a `Filesystem` (multiple files). | ||
*/ | ||
function normalize(specification) { | ||
if (isFilesystem(specification)) { | ||
return specification; | ||
} | ||
if (typeof specification === 'string') { | ||
try { | ||
return JSON.parse(specification); | ||
} | ||
catch (error) { | ||
return parse(specification, { | ||
maxAliasCount: 10000, | ||
}); | ||
} | ||
} | ||
return specification; | ||
} | ||
export { normalize }; |
@@ -1,1 +0,13 @@ | ||
import{details as t}from"../../details.js";import{getEntrypoint as i}from"../../getEntrypoint.js";import{workThroughQueue as o}from"../utils/workThroughQueue.js";async function r(r){const{filesystem:s}=await o(r);return t(i(s).specification)}export{r as details}; | ||
import { details as details$1 } from '../../details.js'; | ||
import { getEntrypoint } from '../../getEntrypoint.js'; | ||
import { workThroughQueue } from '../utils/workThroughQueue.js'; | ||
/** | ||
* Run the chained tasks and return just some basic information about the OpenAPI document | ||
*/ | ||
async function details(queue) { | ||
const { filesystem } = await workThroughQueue(queue); | ||
return details$1(getEntrypoint(filesystem).specification); | ||
} | ||
export { details }; |
@@ -1,1 +0,11 @@ | ||
import{workThroughQueue as t}from"../utils/workThroughQueue.js";async function o(o){const{filesystem:r}=await t(o);return r}export{o as files}; | ||
import { workThroughQueue } from '../utils/workThroughQueue.js'; | ||
/** | ||
* Run the chained tasks and return just the filesystem | ||
*/ | ||
async function files(queue) { | ||
const { filesystem } = await workThroughQueue(queue); | ||
return filesystem; | ||
} | ||
export { files }; |
@@ -1,1 +0,13 @@ | ||
import{workThroughQueue as r}from"../utils/workThroughQueue.js";async function t(t){return{filesystem:[],...await r(t)}}export{t as get}; | ||
import { workThroughQueue } from '../utils/workThroughQueue.js'; | ||
/** | ||
* Run the chained tasks and return the results | ||
*/ | ||
async function get(queue) { | ||
return { | ||
filesystem: [], | ||
...(await workThroughQueue(queue)), | ||
}; | ||
} | ||
export { get }; |
@@ -1,1 +0,13 @@ | ||
import{getEntrypoint as o}from"../../getEntrypoint.js";import{toJson as t}from"../../toJson.js";import{workThroughQueue as r}from"../utils/workThroughQueue.js";async function s(s){const{filesystem:i}=await r(s);return t(o(i).specification)}export{s as toJson}; | ||
import { getEntrypoint } from '../../getEntrypoint.js'; | ||
import { toJson as toJson$1 } from '../../toJson.js'; | ||
import { workThroughQueue } from '../utils/workThroughQueue.js'; | ||
/** | ||
* Run the chained tasks and return the results | ||
*/ | ||
async function toJson(queue) { | ||
const { filesystem } = await workThroughQueue(queue); | ||
return toJson$1(getEntrypoint(filesystem).specification); | ||
} | ||
export { toJson }; |
@@ -1,1 +0,13 @@ | ||
import{getEntrypoint as t}from"../../getEntrypoint.js";import{toYaml as o}from"../../toYaml.js";import{workThroughQueue as r}from"../utils/workThroughQueue.js";async function i(i){const{filesystem:s}=await r(i);return o(t(s).specification)}export{i as toYaml}; | ||
import { getEntrypoint } from '../../getEntrypoint.js'; | ||
import { toYaml as toYaml$1 } from '../../toYaml.js'; | ||
import { workThroughQueue } from '../utils/workThroughQueue.js'; | ||
/** | ||
* Run the chained tasks and return the results | ||
*/ | ||
async function toYaml(queue) { | ||
const { filesystem } = await workThroughQueue(queue); | ||
return toYaml$1(getEntrypoint(filesystem).specification); | ||
} | ||
export { toYaml }; |
@@ -1,1 +0,29 @@ | ||
import{details as o}from"../actions/details.js";import{files as t}from"../actions/files.js";import{get as r}from"../actions/get.js";import{toJson as s}from"../actions/toJson.js";import{toYaml as i}from"../actions/toYaml.js";import{queueTask as n}from"../utils/queueTask.js";function e(e,m){const a={name:"dereference",options:{throwOnError:e.options?.throwOnError,...m??{}}},f=n(e,a);return{details:()=>o(f),files:()=>t(f),get:()=>r(f),toJson:()=>s(f),toYaml:()=>i(f)}}export{e as dereferenceCommand}; | ||
import { details } from '../actions/details.js'; | ||
import { files } from '../actions/files.js'; | ||
import { get } from '../actions/get.js'; | ||
import { toJson } from '../actions/toJson.js'; | ||
import { toYaml } from '../actions/toYaml.js'; | ||
import { queueTask } from '../utils/queueTask.js'; | ||
/** | ||
* Dereference the given OpenAPI document | ||
*/ | ||
function dereferenceCommand(previousQueue, options) { | ||
const task = { | ||
name: 'dereference', | ||
options: { | ||
throwOnError: previousQueue.options?.throwOnError, | ||
...(options ?? {}), | ||
}, | ||
}; | ||
const queue = queueTask(previousQueue, task); | ||
return { | ||
details: () => details(queue), | ||
files: () => files(queue), | ||
get: () => get(queue), | ||
toJson: () => toJson(queue), | ||
toYaml: () => toYaml(queue), | ||
}; | ||
} | ||
export { dereferenceCommand }; |
@@ -1,1 +0,28 @@ | ||
import{details as o}from"../actions/details.js";import{files as t}from"../actions/files.js";import{get as e}from"../actions/get.js";import{toJson as r}from"../actions/toJson.js";import{toYaml as s}from"../actions/toYaml.js";import{queueTask as i}from"../utils/queueTask.js";import{dereferenceCommand as m}from"./dereferenceCommand.js";function n(n,f){const a=i(n,{name:"filter",options:f});return{dereference:o=>m(a,o),details:()=>o(a),files:()=>t(a),get:()=>e(a),toJson:()=>r(a),toYaml:()=>s(a)}}export{n as filterCommand}; | ||
import { details } from '../actions/details.js'; | ||
import { files } from '../actions/files.js'; | ||
import { get } from '../actions/get.js'; | ||
import { toJson } from '../actions/toJson.js'; | ||
import { toYaml } from '../actions/toYaml.js'; | ||
import { queueTask } from '../utils/queueTask.js'; | ||
import { dereferenceCommand } from './dereferenceCommand.js'; | ||
/** | ||
* Filter the given OpenAPI document | ||
*/ | ||
function filterCommand(previousQueue, options) { | ||
const task = { | ||
name: 'filter', | ||
options, | ||
}; | ||
const queue = queueTask(previousQueue, task); | ||
return { | ||
dereference: (dereferenceOptions) => dereferenceCommand(queue, dereferenceOptions), | ||
details: () => details(queue), | ||
files: () => files(queue), | ||
get: () => get(queue), | ||
toJson: () => toJson(queue), | ||
toYaml: () => toYaml(queue), | ||
}; | ||
} | ||
export { filterCommand }; |
@@ -1,1 +0,44 @@ | ||
import{details as o}from"../actions/details.js";import{files as r}from"../actions/files.js";import{get as t}from"../actions/get.js";import{toJson as m}from"../actions/toJson.js";import{toYaml as i}from"../actions/toYaml.js";import{queueTask as e}from"../utils/queueTask.js";import{dereferenceCommand as s}from"./dereferenceCommand.js";import{filterCommand as n}from"./filterCommand.js";import{upgradeCommand as a}from"./upgradeCommand.js";import{validateCommand as f}from"./validateCommand.js";function p(p,d,l){const j={name:"load",options:{throwOnError:p.options?.throwOnError,...l}},c={...e(p,j),input:d};return{dereference:o=>s(c,o),details:()=>o(c),files:()=>r(c),filter:o=>n(c,o),get:()=>t(c),upgrade:()=>a(c),toJson:()=>m(c),toYaml:()=>i(c),validate:o=>f(c,o)}}export{p as loadCommand}; | ||
import { details } from '../actions/details.js'; | ||
import { files } from '../actions/files.js'; | ||
import { get } from '../actions/get.js'; | ||
import { toJson } from '../actions/toJson.js'; | ||
import { toYaml } from '../actions/toYaml.js'; | ||
import { queueTask } from '../utils/queueTask.js'; | ||
import { dereferenceCommand } from './dereferenceCommand.js'; | ||
import { filterCommand } from './filterCommand.js'; | ||
import { upgradeCommand } from './upgradeCommand.js'; | ||
import { validateCommand } from './validateCommand.js'; | ||
/** | ||
* Pass any OpenAPI document | ||
*/ | ||
function loadCommand(previousQueue, input, options) { | ||
const task = { | ||
name: 'load', | ||
options: { | ||
// global | ||
throwOnError: previousQueue.options?.throwOnError, | ||
// local | ||
...options, | ||
}, | ||
}; | ||
const queue = { | ||
// Add the load task | ||
...queueTask(previousQueue, task), | ||
// Add input to the queue | ||
input, | ||
}; | ||
return { | ||
dereference: (dereferenceOptions) => dereferenceCommand(queue, dereferenceOptions), | ||
details: () => details(queue), | ||
files: () => files(queue), | ||
filter: (callback) => filterCommand(queue, callback), | ||
get: () => get(queue), | ||
upgrade: () => upgradeCommand(queue), | ||
toJson: () => toJson(queue), | ||
toYaml: () => toYaml(queue), | ||
validate: (validateOptions) => validateCommand(queue, validateOptions), | ||
}; | ||
} | ||
export { loadCommand }; |
@@ -1,1 +0,31 @@ | ||
import{details as o}from"../actions/details.js";import{files as t}from"../actions/files.js";import{get as r}from"../actions/get.js";import{toJson as m}from"../actions/toJson.js";import{toYaml as e}from"../actions/toYaml.js";import{queueTask as i}from"../utils/queueTask.js";import{dereferenceCommand as s}from"./dereferenceCommand.js";import{filterCommand as a}from"./filterCommand.js";import{validateCommand as n}from"./validateCommand.js";function f(f){const l=i(f,{name:"upgrade"});return{dereference:o=>s(l,o),details:()=>o(l),files:()=>t(l),filter:o=>a(l,o),get:()=>r(l),toJson:()=>m(l),toYaml:()=>e(l),validate:o=>n(l,o)}}export{f as upgradeCommand}; | ||
import { details } from '../actions/details.js'; | ||
import { files } from '../actions/files.js'; | ||
import { get } from '../actions/get.js'; | ||
import { toJson } from '../actions/toJson.js'; | ||
import { toYaml } from '../actions/toYaml.js'; | ||
import { queueTask } from '../utils/queueTask.js'; | ||
import { dereferenceCommand } from './dereferenceCommand.js'; | ||
import { filterCommand } from './filterCommand.js'; | ||
import { validateCommand } from './validateCommand.js'; | ||
/** | ||
* Upgrade the given OpenAPI document | ||
*/ | ||
function upgradeCommand(previousQueue) { | ||
const task = { | ||
name: 'upgrade', | ||
}; | ||
const queue = queueTask(previousQueue, task); | ||
return { | ||
dereference: (dereferenceOptions) => dereferenceCommand(queue, dereferenceOptions), | ||
details: () => details(queue), | ||
files: () => files(queue), | ||
filter: (callback) => filterCommand(queue, callback), | ||
get: () => get(queue), | ||
toJson: () => toJson(queue), | ||
toYaml: () => toYaml(queue), | ||
validate: (validateOptions) => validateCommand(queue, validateOptions), | ||
}; | ||
} | ||
export { upgradeCommand }; |
@@ -1,1 +0,35 @@ | ||
import{details as o}from"../actions/details.js";import{files as r}from"../actions/files.js";import{get as t}from"../actions/get.js";import{toJson as m}from"../actions/toJson.js";import{toYaml as e}from"../actions/toYaml.js";import{queueTask as i}from"../utils/queueTask.js";import{dereferenceCommand as s}from"./dereferenceCommand.js";import{filterCommand as n}from"./filterCommand.js";import{upgradeCommand as a}from"./upgradeCommand.js";function f(f,p){const d={name:"validate",options:{throwOnError:f.options?.throwOnError,...p??{}}},l=i(f,d);return{dereference:o=>s(l,o),details:()=>o(l),files:()=>r(l),filter:o=>n(l,o),get:()=>t(l),toJson:()=>m(l),toYaml:()=>e(l),upgrade:()=>a(l)}}export{f as validateCommand}; | ||
import { details } from '../actions/details.js'; | ||
import { files } from '../actions/files.js'; | ||
import { get } from '../actions/get.js'; | ||
import { toJson } from '../actions/toJson.js'; | ||
import { toYaml } from '../actions/toYaml.js'; | ||
import { queueTask } from '../utils/queueTask.js'; | ||
import { dereferenceCommand } from './dereferenceCommand.js'; | ||
import { filterCommand } from './filterCommand.js'; | ||
import { upgradeCommand } from './upgradeCommand.js'; | ||
/** | ||
* Validate the given OpenAPI document | ||
*/ | ||
function validateCommand(previousQueue, options) { | ||
const task = { | ||
name: 'validate', | ||
options: { | ||
throwOnError: previousQueue.options?.throwOnError, | ||
...(options ?? {}), | ||
}, | ||
}; | ||
const queue = queueTask(previousQueue, task); | ||
return { | ||
dereference: (dereferenceOptions) => dereferenceCommand(queue, dereferenceOptions), | ||
details: () => details(queue), | ||
files: () => files(queue), | ||
filter: (callback) => filterCommand(queue, callback), | ||
get: () => get(queue), | ||
toJson: () => toJson(queue), | ||
toYaml: () => toYaml(queue), | ||
upgrade: () => upgradeCommand(queue), | ||
}; | ||
} | ||
export { validateCommand }; |
@@ -1,1 +0,18 @@ | ||
import{loadCommand as o}from"./commands/loadCommand.js";function n(n){const t={input:null,options:n,tasks:[]};return{load:(n,m)=>o(t,n,m)}}export{n as openapi}; | ||
import { loadCommand } from './commands/loadCommand.js'; | ||
/** | ||
* Creates a fluent OpenAPI pipeline | ||
*/ | ||
function openapi(globalOptions) { | ||
// Create a new queue | ||
const queue = { | ||
input: null, | ||
options: globalOptions, | ||
tasks: [], | ||
}; | ||
return { | ||
load: (input, options) => loadCommand(queue, input, options), | ||
}; | ||
} | ||
export { openapi }; |
@@ -1,1 +0,11 @@ | ||
function t(t,s){return{...t,tasks:[...t.tasks,s]}}export{t as queueTask}; | ||
/** | ||
* Add a new task to the existing queue | ||
*/ | ||
function queueTask(queue, task) { | ||
return { | ||
...queue, | ||
tasks: [...queue.tasks, task], | ||
}; | ||
} | ||
export { queueTask }; |
@@ -1,1 +0,67 @@ | ||
import{dereference as o}from"../../dereference.js";import{filter as t}from"../../filter.js";import{load as e}from"../../load/load.js";import{upgrade as i}from"../../upgrade.js";import{validate as r}from"../../validate.js";async function a(a){const{input:n}={...a};let s={};for(const f of a.tasks){const a=f.name,p="options"in f?f.options:void 0,c=s.specification?s.specification:"object"==typeof n?structuredClone(n):n;"load"===a?s={...s,...await e(n,p)}:"filter"===a?s={...s,...t(c,p)}:"dereference"===a?s={...s,...await o(c,p)}:"upgrade"===a?s={...s,...i(c)}:"validate"===a&&(s={...s,...await r(c,p)})}return s}export{a as workThroughQueue}; | ||
import { dereference } from '../../dereference.js'; | ||
import { filter } from '../../filter.js'; | ||
import { upgrade } from '../../upgrade.js'; | ||
import { validate } from '../../validate.js'; | ||
import { load } from '../../load/load.js'; | ||
/** | ||
* Takes a queue of tasks and works through them | ||
*/ | ||
async function workThroughQueue(queue) { | ||
const { input } = { | ||
...queue, | ||
}; | ||
let result = {}; | ||
// Work through the whole queue | ||
for (const task of queue.tasks) { | ||
const name = task.name; | ||
const options = 'options' in task ? task.options : undefined; | ||
// Use the result of the previous task, or fall back to the original input | ||
const currentSpecification = result.specification | ||
? result.specification | ||
: typeof input === 'object' | ||
? // Detach from the original object | ||
structuredClone(input) | ||
: input; | ||
// load | ||
if (name === 'load') { | ||
result = { | ||
...result, | ||
...(await load(input, options)), | ||
}; | ||
} | ||
// validate | ||
else if (name === 'filter') { | ||
result = { | ||
...result, | ||
...filter(currentSpecification, options), | ||
}; | ||
} | ||
// dereference | ||
else if (name === 'dereference') { | ||
result = { | ||
...result, | ||
...(await dereference(currentSpecification, options)), | ||
}; | ||
} | ||
// upgrade | ||
else if (name === 'upgrade') { | ||
result = { | ||
...result, | ||
...upgrade(currentSpecification), | ||
}; | ||
} | ||
// validate | ||
else if (name === 'validate') { | ||
result = { | ||
...result, | ||
...(await validate(currentSpecification, options)), | ||
}; | ||
} | ||
// Make TS complain when we forgot to handle a command. | ||
else ; | ||
} | ||
return result; | ||
} | ||
export { workThroughQueue }; |
@@ -1,1 +0,153 @@ | ||
import{ERRORS as e}from"../configuration/index.js";import{getEntrypoint as r}from"./getEntrypoint.js";import{getSegmentsFromPath as t}from"./getSegmentsFromPath.js";import{makeFilesystem as o}from"./makeFilesystem.js";function i(e,t,i,E){void 0===E&&(E=[]);const s=structuredClone(e),c=o(s),f=r(c);return a(i?.specification??f.specification,c,i??f),a(i?.specification??f.specification,c,i??f),{valid:0===(E=E.filter(((e,r,t)=>r===t.findIndex((r=>r.message===e.message&&r.code===e.code))))).length,errors:E,schema:(i??r(c)).specification};function a(e,r,o){let i;return Object.entries(e??{}).forEach((([s,c])=>{if(void 0!==e.$ref){const i=n(e.$ref,t,o,r,E);if(void 0===i)return;delete e.$ref,"object"==typeof i&&Object.keys(i).forEach((r=>{void 0===e[r]&&(e[r]=i[r])}))}"object"!=typeof c||function(e){try{return JSON.stringify(e),!1}catch(e){return!0}}(c)||(i=a(c,r,o))})),{errors:i?.errors??[]}}}function n(r,o,E,s,c){if("string"!=typeof r){if(o?.throwOnError)throw new Error(e.INVALID_REFERENCE.replace("%s",r));return void c.push({code:"INVALID_REFERENCE",message:e.INVALID_REFERENCE.replace("%s",r)})}const[f,a]=r.split("#",2),p=f!==E.filename;if(f&&p){const r=s.find((e=>e.filename===f));if(!r){if(o?.throwOnError)throw new Error(e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",f));return void c.push({code:"EXTERNAL_REFERENCE_NOT_FOUND",message:e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",f)})}const t=i(s,o,r,c);return void 0===a?t.schema:n(`#${a}`,o,r,s,c)}const N=t(a);try{return N.reduce(((e,r)=>e[r]),E.specification)}catch(t){if(o?.throwOnError)throw new Error(e.INVALID_REFERENCE.replace("%s",r));c.push({code:"INVALID_REFERENCE",message:e.INVALID_REFERENCE.replace("%s",r)})}}export{i as resolveReferences}; | ||
import { ERRORS } from '../configuration/index.js'; | ||
import { getEntrypoint } from './getEntrypoint.js'; | ||
import { getSegmentsFromPath } from './getSegmentsFromPath.js'; | ||
import { makeFilesystem } from './makeFilesystem.js'; | ||
/** | ||
* Takes a specification and resolves all references. | ||
*/ | ||
function resolveReferences( | ||
// Just a specification, or a set of files. | ||
input, | ||
// Additional options to control the behaviour | ||
options, | ||
// Fallback to the entrypoint | ||
file, | ||
// Errors that occurred during the process | ||
errors) { | ||
// Initialize errors | ||
if (errors === undefined) { | ||
errors = []; | ||
} | ||
// Detach from input | ||
const clonedInput = structuredClone(input); | ||
// Make it a filesystem, even if it’s just one file | ||
const filesystem = makeFilesystem(clonedInput); | ||
// Get the main file | ||
const entrypoint = getEntrypoint(filesystem); | ||
// Recursively resolve all references | ||
resolve(file?.specification ?? entrypoint.specification, filesystem, file ?? entrypoint); | ||
// If we replace references with content, that includes a reference, we can’t deal with that right-away. | ||
// That’s why we need a second run. | ||
resolve(file?.specification ?? entrypoint.specification, filesystem, file ?? entrypoint); | ||
// Remove duplicats (according to message) from errors | ||
errors = errors.filter((error, index, self) => index === | ||
self.findIndex((t) => t.message === error.message && t.code === error.code)); | ||
// Return the resolved specification | ||
return { | ||
valid: errors.length === 0, | ||
errors: errors, | ||
schema: (file ?? getEntrypoint(filesystem)) | ||
.specification, | ||
}; | ||
/** | ||
* Resolves the circular reference to an object and deletes the $ref properties. | ||
*/ | ||
function resolve(schema, resolveFilesystem, resolveFile) { | ||
let result; | ||
// Iterate over the whole objecct | ||
Object.entries(schema ?? {}).forEach(([_, value]) => { | ||
// Ignore parts without a reference | ||
if (schema.$ref !== undefined) { | ||
// Find the referenced content | ||
const target = resolveUri(schema.$ref, options, resolveFile, resolveFilesystem, errors); | ||
if (target === undefined) { | ||
return undefined; | ||
} | ||
// Get rid of the reference | ||
delete schema.$ref; | ||
if (typeof target === 'object') { | ||
Object.keys(target).forEach((key) => { | ||
if (schema[key] === undefined) { | ||
schema[key] = target[key]; | ||
} | ||
}); | ||
} | ||
} | ||
if (typeof value === 'object' && !isCircular(value)) { | ||
result = resolve(value, resolveFilesystem, resolveFile); | ||
} | ||
}); | ||
return { | ||
errors: result?.errors ?? [], | ||
}; | ||
} | ||
} | ||
// TODO: Is there a better way? :D | ||
function isCircular(schema) { | ||
try { | ||
JSON.stringify(schema); | ||
return false; | ||
} | ||
catch (error) { | ||
return true; | ||
} | ||
} | ||
/** | ||
* Resolves a URI to a part of the specification | ||
*/ | ||
function resolveUri( | ||
// 'foobar.json#/foo/bar' | ||
uri, options, | ||
// { filename: './foobar.json '} | ||
file, | ||
// [ { filename: './foobar.json '} ] | ||
filesystem, errors) { | ||
// Ignore invalid URIs | ||
if (typeof uri !== 'string') { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.INVALID_REFERENCE.replace('%s', uri)); | ||
} | ||
errors.push({ | ||
code: 'INVALID_REFERENCE', | ||
message: ERRORS.INVALID_REFERENCE.replace('%s', uri), | ||
}); | ||
return; | ||
} | ||
// Understand the URI | ||
const [prefix, path] = uri.split('#', 2); | ||
/** Check whether the file is pointing to itself */ | ||
const isDifferentFile = prefix !== file.filename; | ||
// External references | ||
if (prefix && isDifferentFile) { | ||
const externalReference = filesystem.find((entry) => { | ||
return entry.filename === prefix; | ||
}); | ||
if (!externalReference) { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', prefix)); | ||
} | ||
errors.push({ | ||
code: 'EXTERNAL_REFERENCE_NOT_FOUND', | ||
message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', prefix), | ||
}); | ||
return; | ||
} | ||
const result = resolveReferences(filesystem, options, externalReference, errors); | ||
// $ref: 'other-file.yaml' | ||
if (path === undefined) { | ||
return result.schema; | ||
} | ||
// $ref: 'other-file.yaml#/foo/bar' | ||
return resolveUri(`#${path}`, options, externalReference, filesystem, errors); | ||
} | ||
// Pointers | ||
const segments = getSegmentsFromPath(path); | ||
// Try to find the URI | ||
try { | ||
return segments.reduce((acc, key) => { | ||
return acc[key]; | ||
}, file.specification); | ||
} | ||
catch (error) { | ||
if (options?.throwOnError) { | ||
throw new Error(ERRORS.INVALID_REFERENCE.replace('%s', uri)); | ||
} | ||
errors.push({ | ||
code: 'INVALID_REFERENCE', | ||
message: ERRORS.INVALID_REFERENCE.replace('%s', uri), | ||
}); | ||
} | ||
} | ||
export { resolveReferences }; |
@@ -1,1 +0,3 @@ | ||
const n=n=>JSON.stringify(n,null,2);export{n as toJson}; | ||
const toJson = (value) => JSON.stringify(value, null, 2); | ||
export { toJson }; |
@@ -1,1 +0,5 @@ | ||
import{stringify as o}from"yaml";const m=m=>o(m);export{m as toYaml}; | ||
import { stringify } from 'yaml'; | ||
const toYaml = (value) => stringify(value); | ||
export { toYaml }; |
@@ -1,1 +0,23 @@ | ||
import{betterAjvErrors as e}from"./betterAjvErrors/index.js";function r(r,t){return"string"==typeof t?[{message:t}]:e(r,null,t,{indent:2}).map((e=>(e.message=e.message.trim(),e)))}export{r as transformErrors}; | ||
import { betterAjvErrors } from './betterAjvErrors/index.js'; | ||
/** | ||
* Transforms ajv errors, finds the positions in the schema and returns an enriched format. | ||
*/ | ||
function transformErrors(specification, errors) { | ||
// TODO: This should work with multiple files | ||
if (typeof errors === 'string') { | ||
return [ | ||
{ | ||
message: errors, | ||
}, | ||
]; | ||
} | ||
return betterAjvErrors(specification, null, errors, { | ||
indent: 2, | ||
}).map((error) => { | ||
error.message = error.message.trim(); | ||
return error; | ||
}); | ||
} | ||
export { transformErrors }; |
@@ -1,1 +0,26 @@ | ||
function t(o,n,r=[]){const e={};for(const[c,f]of Object.entries(o)){const o=[...r,c];Array.isArray(f)?e[c]=f.map(((r,e)=>"object"==typeof r&&null!==r?t(r,n,[...o,e.toString()]):r)):e[c]="object"==typeof f&&null!==f?t(f,n,o):f}return n(e,r)}export{t as traverse}; | ||
/** | ||
* Recursively traverses the specification and applies the transform function to each node. | ||
*/ | ||
function traverse(specification, transform, path = []) { | ||
const result = {}; | ||
for (const [key, value] of Object.entries(specification)) { | ||
const currentPath = [...path, key]; | ||
if (Array.isArray(value)) { | ||
result[key] = value.map((item, index) => { | ||
if (typeof item === 'object' && item !== null) { | ||
return traverse(item, transform, [...currentPath, index.toString()]); | ||
} | ||
return item; | ||
}); | ||
} | ||
else if (typeof value === 'object' && value !== null) { | ||
result[key] = traverse(value, transform, currentPath); | ||
} | ||
else { | ||
result[key] = value; | ||
} | ||
} | ||
return transform(result, path); | ||
} | ||
export { traverse }; |
@@ -1,1 +0,11 @@ | ||
function e(e){return decodeURI(e.replace(/~1/g,"/").replace(/~0/g,"~"))}export{e as unescapeJsonPointer}; | ||
/** | ||
* Unescape JSON pointer | ||
* | ||
* Examples: | ||
* /foo~1bar~0baz -> /foo/bar~baz | ||
*/ | ||
function unescapeJsonPointer(uri) { | ||
return decodeURI(uri.replace(/~1/g, '/').replace(/~0/g, '~')); | ||
} | ||
export { unescapeJsonPointer }; |
@@ -1,1 +0,20 @@ | ||
import{getEntrypoint as r}from"./getEntrypoint.js";import{makeFilesystem as e}from"./makeFilesystem.js";import{upgradeFromThreeToThreeOne as o}from"./upgradeFromThreeToThreeOne.js";import{upgradeFromTwoToThree as i}from"./upgradeFromTwoToThree.js";function t(t){return{specification:[i,o].reduce(((r,e)=>e(r)),r(e(t)).specification),version:"3.1"}}export{t as upgrade}; | ||
import { getEntrypoint } from './getEntrypoint.js'; | ||
import { makeFilesystem } from './makeFilesystem.js'; | ||
import { upgradeFromThreeToThreeOne } from './upgradeFromThreeToThreeOne.js'; | ||
import { upgradeFromTwoToThree } from './upgradeFromTwoToThree.js'; | ||
/** | ||
* Upgrade specification to OpenAPI 3.1.0 | ||
*/ | ||
function upgrade(value) { | ||
const upgraders = [upgradeFromTwoToThree, upgradeFromThreeToThreeOne]; | ||
// TODO: Run upgrade over the whole filesystem | ||
const result = upgraders.reduce((currentSpecification, upgrader) => upgrader(currentSpecification), getEntrypoint(makeFilesystem(value)).specification); | ||
return { | ||
specification: result, | ||
// TODO: Make dynamic | ||
version: '3.1', | ||
}; | ||
} | ||
export { upgrade }; |
@@ -1,1 +0,122 @@ | ||
import{traverse as e}from"./traverse.js";function t(t){let m=t;return m.openapi?.startsWith("3.0")?(m.openapi="3.1.0",m=e(m,(e=>("undefined"!==e.type&&!0===e.nullable&&(e.type=["null",e.type],delete e.nullable),e))),m=e(m,(e=>(!0===e.exclusiveMinimum?(e.exclusiveMinimum=e.minimum,delete e.minimum):!1===e.exclusiveMinimum&&delete e.exclusiveMinimum,!0===e.exclusiveMaximum?(e.exclusiveMaximum=e.maximum,delete e.maximum):!1===e.exclusiveMaximum&&delete e.exclusiveMaximum,e))),m=e(m,((e,t)=>(void 0!==e.example&&(i(t)?e.examples=[e.example]:e.examples={default:e.example},delete e.example),e))),m=e(m,(e=>{if("object"===e.type&&void 0!==e.properties){const t=Object.entries(e.properties);for(const[e,i]of t)"object"==typeof i&&"string"===i.type&&"binary"===i.format&&(i.contentEncoding="application/octet-stream",delete i.format)}return e})),m=e(m,(e=>{if("string"!==e.type||"binary"!==e.format)return e})),m=e(m,(e=>"string"===e.type&&"base64"===e.format?{type:"string",contentEncoding:"base64"}:e)),m):m}function i(e){return[["components","schemas"],"properties","items","allOf","anyOf","oneOf","not","additionalProperties"].some((t=>Array.isArray(t)?t.every(((t,i)=>e[i]===t)):e.includes(t)))||e.includes("schema")||e.some((e=>e.endsWith("Schema")))}export{i as isSchemaPath,t as upgradeFromThreeToThreeOne}; | ||
import { traverse } from './traverse.js'; | ||
/** | ||
* Upgrade from OpenAPI 3.0.x to 3.1.0 | ||
* | ||
* https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0 | ||
*/ | ||
function upgradeFromThreeToThreeOne(originalSpecification) { | ||
let specification = originalSpecification; | ||
// Version | ||
if (specification.openapi?.startsWith('3.0')) { | ||
specification.openapi = '3.1.0'; | ||
} | ||
else { | ||
// Skip if it’s something else than 3.0.x | ||
return specification; | ||
} | ||
// Nullable types | ||
specification = traverse(specification, (schema) => { | ||
if (schema.type !== 'undefined' && schema.nullable === true) { | ||
schema.type = ['null', schema.type]; | ||
delete schema.nullable; | ||
} | ||
return schema; | ||
}); | ||
// exclusiveMinimum and exclusiveMaximum | ||
specification = traverse(specification, (schema) => { | ||
if (schema.exclusiveMinimum === true) { | ||
schema.exclusiveMinimum = schema.minimum; | ||
delete schema.minimum; | ||
} | ||
else if (schema.exclusiveMinimum === false) { | ||
delete schema.exclusiveMinimum; | ||
} | ||
if (schema.exclusiveMaximum === true) { | ||
schema.exclusiveMaximum = schema.maximum; | ||
delete schema.maximum; | ||
} | ||
else if (schema.exclusiveMaximum === false) { | ||
delete schema.exclusiveMaximum; | ||
} | ||
return schema; | ||
}); | ||
// Use examples not example | ||
specification = traverse(specification, (schema, path) => { | ||
if (schema.example !== undefined) { | ||
// Arrays in schemas | ||
if (isSchemaPath(path)) { | ||
schema.examples = [schema.example]; | ||
} | ||
// Objects everywhere else | ||
else { | ||
schema.examples = { | ||
default: schema.example, | ||
}; | ||
} | ||
delete schema.example; | ||
} | ||
return schema; | ||
}); | ||
// Multipart file uploads with a binary file | ||
specification = traverse(specification, (schema) => { | ||
if (schema.type === 'object' && schema.properties !== undefined) { | ||
// Types | ||
const entries = Object.entries(schema.properties); | ||
for (const [_, value] of entries) { | ||
if (typeof value === 'object' && | ||
value.type === 'string' && | ||
value.format === 'binary') { | ||
value.contentEncoding = 'application/octet-stream'; | ||
delete value.format; | ||
} | ||
} | ||
} | ||
return schema; | ||
}); | ||
// Uploading a binary file in a POST request | ||
specification = traverse(specification, (schema) => { | ||
if (schema.type === 'string' && schema.format === 'binary') { | ||
return undefined; | ||
} | ||
return schema; | ||
}); | ||
// Uploading an image with base64 encoding | ||
specification = traverse(specification, (schema) => { | ||
if (schema.type === 'string' && schema.format === 'base64') { | ||
return { | ||
type: 'string', | ||
contentEncoding: 'base64', | ||
}; | ||
} | ||
return schema; | ||
}); | ||
// Declaring $schema Dialects to protect against change | ||
// if (typeof specification.$schema === 'undefined') { | ||
// specification.$schema = 'http://json-schema.org/draft-07/schema#' | ||
// } | ||
return specification; | ||
} | ||
/** Determine if the current path is within a schema */ | ||
function isSchemaPath(path) { | ||
const schemaLocations = [ | ||
['components', 'schemas'], | ||
'properties', | ||
'items', | ||
'allOf', | ||
'anyOf', | ||
'oneOf', | ||
'not', | ||
'additionalProperties', | ||
]; | ||
return (schemaLocations.some((location) => { | ||
if (Array.isArray(location)) { | ||
return location.every((segment, index) => path[index] === segment); | ||
} | ||
return path.includes(location); | ||
}) || | ||
path.includes('schema') || | ||
path.some((segment) => segment.endsWith('Schema'))); | ||
} | ||
export { isSchemaPath, upgradeFromThreeToThreeOne }; |
@@ -1,1 +0,174 @@ | ||
import{traverse as e}from"./traverse.js";function t(t){if(!t.swagger?.startsWith("2.0"))return t;if(t.openapi="3.0.3",delete t.swagger,console.warn("[upgradeFromTwoToThree] The upgrade from Swagger 2.0 to OpenAPI 3.0 documents is experimental and lacks features."),t.host){const e=t.schemes?.length?t.schemes:["http"];t.servers=e.map((e=>({url:`${e}://${t.host}${t.basePath??""}`}))),delete t.basePath,delete t.schemes,delete t.host}if(t.definitions&&("object"!=typeof t.components&&(t.components={}),t.components.schemas=t.definitions,delete t.definitions,t=e(t,(e=>(e.$ref?.startsWith("#/definitions/")&&(e.$ref=e.$ref.replace(/^#\/definitions\//,"#/components/schemas/")),e)))),t.paths)for(const e in t.paths)if(Object.hasOwn(t.paths,e)){const o=t.paths[e];for(const e in o)if(Object.hasOwn(o,e)){const s=o[e];if(s.parameters){const e=structuredClone(s.parameters.find((e=>"body"===e.in))??{});if(e&&Object.keys(e).length){delete e.name,delete e.in;const o=t.consumes??s.consumes??["application/json"];"object"!=typeof s.requestBody&&(s.requestBody={}),"object"!=typeof s.requestBody.content&&(s.requestBody.content={});const{schema:n,...r}=e;s.requestBody={...s.requestBody,...r};for(const e of o)s.requestBody.content[e]={schema:n}}s.parameters=s.parameters.filter((e=>"body"!==e.in)),delete s.consumes;const o=s.parameters.filter((e=>"formData"===e.in));if(o.length>0){"object"!=typeof s.requestBody&&(s.requestBody={}),"object"!=typeof s.requestBody.content&&(s.requestBody.content={}),s.requestBody.content["application/x-www-form-urlencoded"]={schema:{type:"object",properties:{},required:[]}};for(const e of o)s.requestBody.content["application/x-www-form-urlencoded"].schema.properties[e.name]={type:e.type,description:e.description},e.required&&s.requestBody.content["application/x-www-form-urlencoded"].schema.required.push(e.name);s.parameters=s.parameters.filter((e=>"formData"!==e.in))}}if(s.responses)for(const e in s.responses)if(Object.hasOwn(s.responses,e)){const o=s.responses[e];if(o.schema){const e=t.produces??s.produces??["application/json"];"object"!=typeof o.content&&(o.content={});for(const t of e)o.content[t]={schema:o.schema};delete o.schema}}delete s.produces,0===s.parameters?.length&&delete s.parameters}}if(t.securityDefinitions){"object"!=typeof t.components&&(t.components={}),t.components.securitySchemes={};for(const[e,o]of Object.entries(t.securityDefinitions))if("object"==typeof o)if("type"in o&&"oauth2"===o.type){const{flow:s,authorizationUrl:n,tokenUrl:r,scopes:c}=o;t.components.securitySchemes[e]={type:"oauth2",flows:{[s]:{...n&&{authorizationUrl:n},...r&&{tokenUrl:r},...c&&{scopes:c}}}}}else t.components.securitySchemes[e]=o;delete t.securityDefinitions}return t}export{t as upgradeFromTwoToThree}; | ||
import { traverse } from './traverse.js'; | ||
/** | ||
* Upgrade Swagger 2.0 to OpenAPI 3.0 | ||
* | ||
* https://swagger.io/blog/news/whats-new-in-openapi-3-0/ | ||
*/ | ||
function upgradeFromTwoToThree(specification) { | ||
// Version | ||
if (specification.swagger?.startsWith('2.0')) { | ||
specification.openapi = '3.0.3'; | ||
delete specification.swagger; | ||
} | ||
else { | ||
// Skip if it’s something else than 3.0.x | ||
return specification; | ||
} | ||
console.warn(`[upgradeFromTwoToThree] The upgrade from Swagger 2.0 to OpenAPI 3.0 documents is experimental and lacks features.`); | ||
// Servers | ||
if (specification.host) { | ||
const schemes = specification.schemes?.length | ||
? specification.schemes | ||
: ['http']; | ||
specification.servers = schemes.map((scheme) => ({ | ||
url: `${scheme}://${specification.host}${specification.basePath ?? ''}`, | ||
})); | ||
delete specification.basePath; | ||
delete specification.schemes; | ||
delete specification.host; | ||
} | ||
// Schemas | ||
if (specification.definitions) { | ||
if (typeof specification.components !== 'object') { | ||
specification.components = {}; | ||
} | ||
specification.components.schemas = specification.definitions; | ||
delete specification.definitions; | ||
// Rewrite $refs to definitions | ||
specification = traverse(specification, (schema) => { | ||
if (schema.$ref?.startsWith('#/definitions/')) { | ||
schema.$ref = schema.$ref.replace(/^#\/definitions\//, '#/components/schemas/'); | ||
} | ||
return schema; | ||
}); | ||
} | ||
// Paths | ||
if (specification.paths) { | ||
for (const path in specification.paths) { | ||
if (Object.hasOwn(specification.paths, path)) { | ||
const pathItem = specification.paths[path]; | ||
for (const method in pathItem) { | ||
if (Object.hasOwn(pathItem, method)) { | ||
const operationItem = pathItem[method]; | ||
// Request bodies | ||
if (operationItem.parameters) { | ||
const bodyParameter = structuredClone(operationItem.parameters.find((parameter) => parameter.in === 'body') ?? {}); | ||
if (bodyParameter && Object.keys(bodyParameter).length) { | ||
delete bodyParameter.name; | ||
delete bodyParameter.in; | ||
const consumes = specification.consumes ?? | ||
operationItem.consumes ?? ['application/json']; | ||
if (typeof operationItem.requestBody !== 'object') { | ||
operationItem.requestBody = {}; | ||
} | ||
if (typeof operationItem.requestBody.content !== 'object') { | ||
operationItem.requestBody.content = {}; | ||
} | ||
const { schema, ...requestBody } = bodyParameter; | ||
operationItem.requestBody = { | ||
...operationItem.requestBody, | ||
...requestBody, | ||
}; | ||
for (const type of consumes) { | ||
operationItem.requestBody.content[type] = { | ||
schema: schema, | ||
}; | ||
} | ||
} | ||
// Delete body parameter | ||
operationItem.parameters = operationItem.parameters.filter((parameter) => parameter.in !== 'body'); | ||
delete operationItem.consumes; | ||
// formData parameters | ||
const formDataParameters = operationItem.parameters.filter((parameter) => parameter.in === 'formData'); | ||
if (formDataParameters.length > 0) { | ||
if (typeof operationItem.requestBody !== 'object') { | ||
operationItem.requestBody = {}; | ||
} | ||
if (typeof operationItem.requestBody.content !== 'object') { | ||
operationItem.requestBody.content = {}; | ||
} | ||
operationItem.requestBody.content['application/x-www-form-urlencoded'] = { | ||
schema: { | ||
type: 'object', | ||
properties: {}, | ||
required: [], // Initialize required array | ||
}, | ||
}; | ||
for (const param of formDataParameters) { | ||
operationItem.requestBody.content['application/x-www-form-urlencoded'].schema.properties[param.name] = { | ||
type: param.type, | ||
description: param.description, | ||
}; | ||
// Add to required array if param is required | ||
if (param.required) { | ||
operationItem.requestBody.content['application/x-www-form-urlencoded'].schema.required.push(param.name); | ||
} | ||
} | ||
// Remove formData parameters from the parameters array | ||
operationItem.parameters = operationItem.parameters.filter((parameter) => parameter.in !== 'formData'); | ||
} | ||
} | ||
// Responses | ||
if (operationItem.responses) { | ||
for (const response in operationItem.responses) { | ||
if (Object.hasOwn(operationItem.responses, response)) { | ||
const responseItem = operationItem.responses[response]; | ||
if (responseItem.schema) { | ||
const produces = specification.produces ?? | ||
operationItem.produces ?? ['application/json']; | ||
if (typeof responseItem.content !== 'object') { | ||
responseItem.content = {}; | ||
} | ||
for (const type of produces) { | ||
responseItem.content[type] = { | ||
schema: responseItem.schema, | ||
}; | ||
} | ||
delete responseItem.schema; | ||
} | ||
} | ||
} | ||
} | ||
delete operationItem.produces; | ||
// Delete empty parameters | ||
if (operationItem.parameters?.length === 0) { | ||
delete operationItem.parameters; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
// Upgrade securityDefinitions | ||
if (specification.securityDefinitions) { | ||
if (typeof specification.components !== 'object') { | ||
specification.components = {}; | ||
} | ||
specification.components.securitySchemes = {}; | ||
for (const [key, securityScheme] of Object.entries(specification.securityDefinitions)) { | ||
if (typeof securityScheme === 'object') { | ||
if ('type' in securityScheme && securityScheme.type === 'oauth2') { | ||
const { flow, authorizationUrl, tokenUrl, scopes } = securityScheme; | ||
specification.components.securitySchemes[key] = { | ||
type: 'oauth2', | ||
flows: { | ||
[flow]: { | ||
...(authorizationUrl && { authorizationUrl }), | ||
...(tokenUrl && { tokenUrl }), | ||
...(scopes && { scopes }), | ||
}, | ||
}, | ||
}; | ||
} | ||
else { | ||
specification.components.securitySchemes[key] = securityScheme; | ||
} | ||
} | ||
} | ||
delete specification.securityDefinitions; | ||
} | ||
return specification; | ||
} | ||
export { upgradeFromTwoToThree }; |
@@ -1,1 +0,18 @@ | ||
import{Validator as i}from"../lib/Validator/Validator.js";import{makeFilesystem as o}from"./makeFilesystem.js";async function t(t,a){const e=o(t),r=new i;return{...await r.validate(e,a),specification:r.specification,version:r.version}}export{t as validate}; | ||
import { makeFilesystem } from './makeFilesystem.js'; | ||
import { Validator } from '../lib/Validator/Validator.js'; | ||
/** | ||
* Validates an OpenAPI schema. | ||
*/ | ||
async function validate(value, options) { | ||
const filesystem = makeFilesystem(value); | ||
const validator = new Validator(); | ||
const result = await validator.validate(filesystem, options); | ||
return { | ||
...result, | ||
specification: validator.specification, | ||
version: validator.version, | ||
}; | ||
} | ||
export { validate }; |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "0.8.6", | ||
"version": "0.8.7", | ||
"engines": { | ||
@@ -30,9 +30,15 @@ "node": ">=18" | ||
".": { | ||
"import": "./dist/index.js" | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"./plugins/fetch-urls": { | ||
"import": "./dist/utils/load/plugins/fetchUrls.js" | ||
"import": "./dist/plugins/fetch-urls/index.js", | ||
"types": "./dist/plugins/fetch-urls/index.d.ts", | ||
"default": "./dist/plugins/fetch-urls/index.js" | ||
}, | ||
"./plugins/read-files": { | ||
"import": "./dist/utils/load/plugins/readFiles.js" | ||
"import": "./dist/plugins/read-files/index.js", | ||
"types": "./dist/plugins/read-files/index.d.ts", | ||
"default": "./dist/plugins/read-files/index.js" | ||
} | ||
@@ -58,5 +64,2 @@ }, | ||
"@google-cloud/storage": "^7.12.1", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@types/node": "^20.14.10", | ||
@@ -66,9 +69,8 @@ "glob": "^10.3.10", | ||
"just-diff": "^6.0.2", | ||
"rollup": "^4.16.4", | ||
"rollup-plugin-output-size": "^1.4.1", | ||
"tinybench": "^2.8.0", | ||
"@scalar/openapi-types": "0.1.2" | ||
"@scalar/build-tooling": "0.1.11", | ||
"@scalar/openapi-types": "0.1.3" | ||
}, | ||
"scripts": { | ||
"build": "pnpm types:check && rollup -c --configPlugin typescript && pnpm types:build", | ||
"build": "scalar-build-rollup", | ||
"format": "prettier --write .", | ||
@@ -80,5 +82,5 @@ "lint:check": "eslint .", | ||
"test:unit": "vite-node scripts/load-files.ts && vitest", | ||
"types:build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json", | ||
"types:check": "tsc --noEmit --skipLibCheck" | ||
"types:build": "scalar-types-build", | ||
"types:check": "scalar-types-check" | ||
} | ||
} |
@@ -245,2 +245,2 @@ # Scalar OpenAPI Parser | ||
The source code in this repository is licensed under [MIT](https://github.com/scalar/openapi-parser/blob/main/LICENSE). | ||
The source code in this repository is licensed under [MIT](https://github.com/scalar/scalar/blob/main/LICENSE). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1949032
10
174
28069