@redocly/openapi-docs 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortenHTTPVerb=void 0,exports.isStatusCode=isStatusCode,exports.getStatusCodeType=getStatusCodeType,exports.isOperationName=isOperationName,exports.getOperationName=getOperationName,exports.getOperationId=getOperationId,exports.detectType=detectType,exports.isPrimitiveType=isPrimitiveType,exports.isJsonLike=isJsonLike,exports.isXmlLike=isXmlLike,exports.isFormUrlEncoded=isFormUrlEncoded,exports.isMultipartFormData=isMultipartFormData,exports.urlFormEncodePayload=urlFormEncodePayload,exports.serializeQueryParameter=serializeQueryParameter,exports.serializeParameterValueWithMime=serializeParameterValueWithMime,exports.serializeParameterValue=serializeParameterValue,exports.langFromMime=langFromMime,exports.isNamedDefinition=isNamedDefinition,exports.getDefinitionName=getDefinitionName,exports.humanizeNumberRange=humanizeNumberRange,exports.humanizeConstraints=humanizeConstraints,exports.sortByRequired=sortByRequired,exports.sortByDeprecated=sortByDeprecated,exports.mergeParams=mergeParams,exports.normalizeServers=normalizeServers,exports.isRedocExtension=isRedocExtension,exports.extractExtensions=extractExtensions,exports.pluralizeType=pluralizeType,exports.getContentWithLegacyExamples=getContentWithLegacyExamples;const path_1=require("path"),url_template_1=__importDefault(require("url-template")),theme_1=require("@redocly/theme"),helpers_1=require("./helpers"),constants_1=require("../constants"),JsonPointer_1=require("./JsonPointer"),services_1=require("../services");function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}function isStatusCode(e){return"default"===e||(0,helpers_1.isNumeric)(e)||isWildcardStatusCode(e)}function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};function isOperationName(e){return e in operationNames}function getOperationName(e){const{operationId:r,pathName:t}=e,i=(0,helpers_1.normalizeText)((0,helpers_1.getValueFromMdParsedExtension)(e,"description"));return(0,helpers_1.normalizeText)((0,helpers_1.getValueFromMdParsedExtension)(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}function getOperationId(e,r){var t;return(null==r?void 0:r.id)?(0,services_1.joinWithSeparator)(r.id,(0,helpers_1.sanitizeItemId)(e.operationId?e.operationId:pointerToId(e.pointer))).toLowerCase():(null===(t=e.tags)||void 0===t?void 0:t.length)?(0,helpers_1.sanitizeItemId)(e.operationId?e.operationId:pointerToId(e.pointer)):(0,helpers_1.sanitizeItemId)(e.operationId?(0,services_1.joinWithSeparator)(constants_1.DEFAULT_TAG_SLUG,e.operationId):pointerToId(e.pointer))}function pointerToId(e){return(null==e?void 0:e.startsWith("/"))?e.slice(1,e.length):e}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}function isJsonLike(e){return-1!==e.search(/json/i)}function isXmlLike(e){return-1!==(null==e?void 0:e.search(/xml/i))}function isFormUrlEncoded(e){return e===constants_1.MediaTypes.URL_ENCODED}function isMultipartFormData(e){return e===constants_1.MediaTypes.MULTIPART}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return url_template_1.default.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=url_template_1.default.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return url_template_1.default.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)||"object"==typeof n?t?serializeFormValue(e,t,n):delimitedEncodeField(i,e,"%20"):(console.warn("The style spaceDelimited is applicable to arrays or objects"),"");case"pipeDelimited":return Array.isArray(n)||"object"==typeof n?t?serializeFormValue(e,t,n):delimitedEncodeField(i,e,"|"):(console.warn("The style pipeDelimited is applicable to arrays or objects"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return(0,helpers_1.isArrayOfObjects)(i)&&(i=(0,helpers_1.deleteEmptyArrayItem)(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint(1===e.minProperties&&1===e.maxProperties?"property":"properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}function sortByDeprecated(e){return e.sort(((e,r)=>Number(e.deprecated)-Number(r.deprecated)))}function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer_1.JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer_1.JsonPointer.join(n,["parameters",String(r)])})))]}function normalizeServers(e,r){const t=void 0===e?(0,helpers_1.removeQueryStringAndHash)((()=>{if(!theme_1.IS_BROWSER)return globalThis.SSR_HOSTNAME||"";const e=window.location.href;return e.endsWith(".html")?(0,path_1.dirname)(e):e})()):(0,path_1.dirname)(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,(0,helpers_1.resolveUrl)(t,r)),description:e.description||""});var r}))}const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideReplay":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0,"x-badges":!0}||e.startsWith("x-parsed-md-")}function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}exports.shortenHTTPVerb=shortenHTTPVerb;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortenHTTPVerb=void 0,exports.isStatusCode=isStatusCode,exports.getStatusCodeType=getStatusCodeType,exports.isOperationName=isOperationName,exports.getOperationName=getOperationName,exports.getOperationId=getOperationId,exports.detectType=detectType,exports.isPrimitiveType=isPrimitiveType,exports.isJsonLike=isJsonLike,exports.isXmlLike=isXmlLike,exports.isFormUrlEncoded=isFormUrlEncoded,exports.isMultipartFormData=isMultipartFormData,exports.urlFormEncodePayload=urlFormEncodePayload,exports.serializeQueryParameter=serializeQueryParameter,exports.serializeParameterValueWithMime=serializeParameterValueWithMime,exports.serializeParameterValue=serializeParameterValue,exports.langFromMime=langFromMime,exports.isNamedDefinition=isNamedDefinition,exports.getDefinitionName=getDefinitionName,exports.humanizeNumberRange=humanizeNumberRange,exports.humanizeConstraints=humanizeConstraints,exports.sortByRequired=sortByRequired,exports.sortByDeprecated=sortByDeprecated,exports.mergeParams=mergeParams,exports.normalizeServers=normalizeServers,exports.isRedocExtension=isRedocExtension,exports.extractExtensions=extractExtensions,exports.pluralizeType=pluralizeType,exports.getContentWithLegacyExamples=getContentWithLegacyExamples;const path_1=require("path"),url_template_1=__importDefault(require("url-template")),theme_1=require("@redocly/theme"),helpers_1=require("./helpers"),constants_1=require("../constants"),JsonPointer_1=require("./JsonPointer"),services_1=require("../services");function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}function isStatusCode(e){return"default"===e||(0,helpers_1.isNumeric)(e)||isWildcardStatusCode(e)}function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};function isOperationName(e){return e in operationNames}function getOperationName(e){const{operationId:r,pathName:t}=e,i=(0,helpers_1.normalizeText)((0,helpers_1.getValueFromMdParsedExtension)(e,"description"));return(0,helpers_1.normalizeText)((0,helpers_1.getValueFromMdParsedExtension)(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}function getOperationId(e,r){var t;return(null==r?void 0:r.id)?(0,services_1.joinWithSeparator)(r.id,(0,helpers_1.sanitizeItemId)(e.operationId?e.operationId:pointerToId(e.pointer))).toLowerCase():(null===(t=e.tags)||void 0===t?void 0:t.length)?(0,helpers_1.sanitizeItemId)(e.operationId?e.operationId:pointerToId(e.pointer)):(0,helpers_1.sanitizeItemId)(e.operationId?(0,services_1.joinWithSeparator)(constants_1.DEFAULT_TAG_SLUG,e.operationId):pointerToId(e.pointer))}function pointerToId(e){return(null==e?void 0:e.startsWith("/"))?e.slice(1,e.length):e}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}function isJsonLike(e){return-1!==e.search(/json/i)}function isXmlLike(e){return-1!==(null==e?void 0:e.search(/xml/i))}function isFormUrlEncoded(e){return e===constants_1.MediaTypes.URL_ENCODED}function isMultipartFormData(e){return e===constants_1.MediaTypes.MULTIPART}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return url_template_1.default.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=url_template_1.default.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return url_template_1.default.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)||"object"==typeof n?t?serializeFormValue(e,t,n):delimitedEncodeField(i,e,"%20"):(console.warn("The style spaceDelimited is applicable to arrays or objects"),"");case"pipeDelimited":return Array.isArray(n)||"object"==typeof n?t?serializeFormValue(e,t,n):delimitedEncodeField(i,e,"|"):(console.warn("The style pipeDelimited is applicable to arrays or objects"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return(0,helpers_1.isArrayOfObjects)(i)&&(i=(0,helpers_1.deleteEmptyArrayItem)(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint(1===e.minProperties&&1===e.maxProperties?"property":"properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}function sortByDeprecated(e){return e.sort(((e,r)=>Number(e.deprecated)-Number(r.deprecated)))}function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer_1.JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer_1.JsonPointer.join(n,["parameters",String(r)])})))]}function normalizeServers(e,r){const t=void 0===e?(0,helpers_1.removeQueryStringAndHash)((()=>{if(!theme_1.IS_BROWSER)return globalThis.SSR_HOSTNAME||"";const e=window.location.href;return e.endsWith(".html")?(0,path_1.dirname)(e):e})()):(0,path_1.dirname)(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,(0,helpers_1.resolveUrl)(t,r)),description:e.description||""});var r}))}const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideReplay":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0,"x-badges":!0,"x-rbac":!0}||e.startsWith("x-parsed-md-")}function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}exports.shortenHTTPVerb=shortenHTTPVerb;
2
2
  //# sourceMappingURL=openapi.js.map
@@ -1,2 +1,2 @@
1
- import{extractExtensions,getValueFromMdParsedExtension,mapValues}from"../utils";import{getSchema}from"./schema";import{getExamples}from"./example";const DEFAULT_SERIALIZATION={path:{style:"simple",explode:!1},query:{style:"form",explode:!0},header:{style:"simple",explode:!1},cookie:{style:"form",explode:!0}};export function getField(e,o,t,l,i,n,s=t){var d,a,r,p,m,c,x;const{resolved:u}=e.deref(o),v=o.kind||"field",f=o.name||u.name,h=u.in,E=!!u.required;let g,F,y=u.schema,O="";if(!y&&u.in&&u.content){O=Object.keys(u.content)[0];const o=u.content[O];y=o&&(null==o?void 0:o.example)?Object.assign(Object.assign({},e.deref(o.schema,n,!0).resolved),{example:u.example||o.example}):o.schema}const A=(null==i?void 0:i.parentFieldFullPath)?i.parentFieldFullPath+"/"+f:f,I=getSchema({parser:e,schemaOrRef:y||{},pointer:t,options:l,baseRefsStack:n,absolutePointer:o.$ref||(null===(d=u.schema)||void 0===d?void 0:d.absolutePointer)||s,deps:Object.assign(Object.assign({},i),{parentFieldFullPath:A,in:h})}),P=void 0===u.description?getValueFromMdParsedExtension(I,"description")||"":getValueFromMdParsedExtension(u,"description"),b=u.example||I.example,L=u.examples||(null===(r=null===(a=u.content)||void 0===a?void 0:a[O])||void 0===r?void 0:r.examples),R=L?mapValues(L,((o,t)=>getExamples({parser:e,infoOrRef:o,mime:t,encoding:u.encoding}))):void 0;O?g=O:u.style?F=u.style:h&&(F=null!==(m=null===(p=DEFAULT_SERIALIZATION[h])||void 0===p?void 0:p.style)&&void 0!==m?m:"form");const S=void 0===u.explode&&h?null===(x=null===(c=DEFAULT_SERIALIZATION[h])||void 0===c?void 0:c.explode)||void 0===x||x:!!u.explode;return{deps:i||{},schema:I,name:f,required:E,description:P,example:b,examples:R,deprecated:void 0===u.deprecated?I.deprecated:u.deprecated,in:h,kind:v,extensions:l.showExtensions?extractExtensions(u,l.showExtensions):void 0,explode:S,style:F,const:(null==I?void 0:I.const)||(null==u?void 0:u.const)||"",serializationMime:g,fieldFullPath:A}}
1
+ import{REDOCLY_TEAMS_RBAC}from"@redocly/config";import{extractExtensions,getValueFromMdParsedExtension,mapValues}from"../utils";import{getSchema}from"./schema";import{getExamples}from"./example";const DEFAULT_SERIALIZATION={path:{style:"simple",explode:!1},query:{style:"form",explode:!0},header:{style:"simple",explode:!1},cookie:{style:"form",explode:!0}};export function getField(e,o,t,l,i,n,s=t){var d,a,r,p,m,c,x;const{resolved:u}=e.deref(o),v=o.kind||"field",E=o.name||u.name,f=u.in,h=!!u.required;let A,g,F=u.schema,O="";if(!F&&u.in&&u.content){O=Object.keys(u.content)[0];const o=u.content[O];F=o&&(null==o?void 0:o.example)?Object.assign(Object.assign({},e.deref(o.schema,n,!0).resolved),{example:u.example||o.example}):o.schema}const R=(null==i?void 0:i.parentFieldFullPath)?i.parentFieldFullPath+"/"+E:E,y=getSchema({parser:e,schemaOrRef:F||{},pointer:t,options:l,baseRefsStack:n,absolutePointer:o.$ref||(null===(d=u.schema)||void 0===d?void 0:d.absolutePointer)||s,deps:Object.assign(Object.assign({},i),{parentFieldFullPath:R,in:f})}),_=void 0===u.description?getValueFromMdParsedExtension(y,"description")||"":getValueFromMdParsedExtension(u,"description"),L=u.example||y.example,S=u.examples||(null===(r=null===(a=u.content)||void 0===a?void 0:a[O])||void 0===r?void 0:r.examples),T=S?mapValues(S,((o,t)=>getExamples({parser:e,infoOrRef:o,mime:t,encoding:u.encoding}))):void 0;O?A=O:u.style?g=u.style:f&&(g=null!==(m=null===(p=DEFAULT_SERIALIZATION[f])||void 0===p?void 0:p.style)&&void 0!==m?m:"form");const I=void 0===u.explode&&f?null===(x=null===(c=DEFAULT_SERIALIZATION[f])||void 0===c?void 0:c.explode)||void 0===x||x:!!u.explode;return{deps:i||{},schema:y,name:E,required:h,description:_,example:L,examples:T,deprecated:void 0===u.deprecated?y.deprecated:u.deprecated,in:f,kind:v,extensions:l.showExtensions?extractExtensions(u,l.showExtensions):void 0,explode:I,style:g,const:(null==y?void 0:y.const)||(null==u?void 0:u.const)||"",serializationMime:A,fieldFullPath:R,[REDOCLY_TEAMS_RBAC]:u[REDOCLY_TEAMS_RBAC]||y[REDOCLY_TEAMS_RBAC]}}
2
2
  //# sourceMappingURL=field.js.map
@@ -1,2 +1,2 @@
1
- import{joinWithSeparator}from"../services";import{getValueFromMdParsedExtension,safeSlugify}from"../utils";import{getHref}from"../services/menu/operation";import{saveTextBeforeHeading}from"../utils/saveTextBeforeHeading";export function getTagOrGroup(e,i,t){let r;r=(null==t?void 0:t.id)&&"schema"===e?joinWithSeparator(t.id,safeSlugify(i.name)):i.id||safeSlugify(i.name);const a=i["x-displayName"]||i.name,o=i.level||1,s=i.isSchema,n=i.ast||void 0,m=saveTextBeforeHeading(getValueFromMdParsedExtension(i,"description")||""),d=i.items||[],f=i.externalDocs;return{id:r.toLowerCase(),type:e,parent:t,name:a,level:o,depth:0,isSchema:s,description:m,items:d,ast:n,externalDocs:f,href:getHref({id:r})}}
1
+ import{REDOCLY_TEAMS_RBAC}from"@redocly/config";import{joinWithSeparator}from"../services";import{getValueFromMdParsedExtension,safeSlugify}from"../utils";import{getHref}from"../services/menu/operation";import{saveTextBeforeHeading}from"../utils/saveTextBeforeHeading";export function getTagOrGroup(e,i,r){let t;t=(null==r?void 0:r.id)&&"schema"===e?joinWithSeparator(r.id,safeSlugify(i.name)):i.id||safeSlugify(i.name);const o=i["x-displayName"]||i.name,a=i.level||1,s=i.isSchema,n=i.ast||void 0,m=saveTextBeforeHeading(getValueFromMdParsedExtension(i,"description")||""),d=i.items||[],l=i.externalDocs;return{id:t.toLowerCase(),type:e,parent:r,name:o,level:a,depth:0,isSchema:s,description:m,items:d,ast:n,externalDocs:l,href:getHref({id:t}),[REDOCLY_TEAMS_RBAC]:i[REDOCLY_TEAMS_RBAC]||(null==r?void 0:r[REDOCLY_TEAMS_RBAC])}}
2
2
  //# sourceMappingURL=group.js.map
@@ -1,2 +1,2 @@
1
- import{removeLeadingSlash}from"@redocly/theme";import{extractExtensions,getOperationId,getOperationName,getStatusCodeType,getValueFromMdParsedExtension,isStatusCode,JsonPointer,mergeParams,normalizeServers,sortByDeprecated,sortByRequired}from"../utils";import{getCallback}from"./callback";import{getField}from"./field";import{getRequestBody}from"./request";import{getSecurityRequirement}from"./security";import{getResponse}from"./response";import{getHref}from"../services/menu/operation";export function isPayloadSample(e){return"Payload"===e.lang&&"requestBodyContent"in e}export function getOperation(e,r,t,o,i,s){var a,n;const l=r.isWebhook,p={operationDefinition:r,parent:t,pointer:r.pointer,description:getValueFromMdParsedExtension(r,"description"),externalDocs:r.externalDocs,deprecated:!!r.deprecated,httpVerb:r.httpVerb,operationId:r.operationId,path:r.pathName,isWebhook:l,isCallback:Boolean(null==s?void 0:s.isCallback),isEvent:(null==s?void 0:s.isCallback)||l,name:getOperationName(r),defaultExampleName:r.defaultSampleName,type:"operation",callbackId:null==s?void 0:s.id,href:i,get callbacks(){return Object.keys(r.callbacks||[]).map((s=>{var a;return getCallback(e,s,null===(a=r.callbacks)||void 0===a?void 0:a[s],p.pointer,o,i,t)}))},get responses(){let t=!1;return Object.keys(r.responses||[]).filter((e=>"default"===e||("success"===getStatusCodeType(e)&&(t=!0),isStatusCode(e)))).map((i=>getResponse({parser:e,code:i,defaultAsError:t,infoOrRef:r.responses[i],options:o,isEvent:p.isEvent,operation:p})))},get parameters(){let t=mergeParams(e,r.pathParameters,r.parameters,{pathPointer:JsonPointer.dirName(p.pointer),operationPointer:p.pointer}).map((({paramOrRef:r,pointer:t})=>getField(e,r,t,o,{operation:p,type:"request"})));return o.sortRequiredPropsFirst&&(t=sortByRequired(t)),sortByDeprecated(t)}};if(null==s?void 0:s.isCallback)p.security=(Array.isArray(r.security)?r.security:[]).map((r=>getSecurityRequirement({requirement:r,parser:e}))),p.servers=normalizeServers("",r.servers||r.pathServers||[]),p.id=removeLeadingSlash(i);else{p.id=getOperationId(r,t),p.href=p.href||getHref(p);const i=r.security||e.definition.security;p.security=(Array.isArray(i)?i:[]).map((r=>getSecurityRequirement({requirement:r,parser:e}))),p.servers=normalizeServers(e.definitionUrl,mergeInMockServer(r.servers||r.pathServers||e.definition.servers||[],o.mockServer))}o.showExtensions&&(p.extensions=extractExtensions(r,o.showExtensions)),p.requestBody=r.requestBody&&getRequestBody({parser:e,infoOrRef:r.requestBody,options:o,operation:p,isEvent:p.isEvent});const d=null===(a=p.requestBody)||void 0===a?void 0:a.content;return p.payload={lang:"Payload",source:"",requestBodyContent:(null==d?void 0:d.hasSample)?d:void 0},p.definitionSamples=r["x-codeSamples"]||[],p.badges=(null===(n=r["x-badges"])||void 0===n?void 0:n.map((({name:e,color:r,position:t})=>({name:e,color:r||"var(--color-info-base)",position:t||"after"}))))||[],p.hasSamples=(null==d?void 0:d.hasSample)||p.definitionSamples.length>0,p.hideReplay=!0===r["x-hideReplay"],p}export function mergeInMockServer(e,r){if(!r)return e;const t={url:r.url,description:r.description};switch(r.position){case"first":return[t,...e];case"last":return[...e,t];case"replace":return[t];default:return e}}
1
+ import{removeLeadingSlash}from"@redocly/theme";import{REDOCLY_TEAMS_RBAC}from"@redocly/config";import{extractExtensions,getOperationId,getOperationName,getStatusCodeType,getValueFromMdParsedExtension,isStatusCode,JsonPointer,mergeParams,normalizeServers,sortByDeprecated,sortByRequired}from"../utils";import{getCallback}from"./callback";import{getField}from"./field";import{getRequestBody}from"./request";import{getSecurityRequirement}from"./security";import{getResponse}from"./response";import{getHref}from"../services/menu/operation";export function isPayloadSample(e){return"Payload"===e.lang&&"requestBodyContent"in e}export function getOperation(e,r,t,o,i,s){var a,n;const l=r.isWebhook,p={operationDefinition:r,parent:t,pointer:r.pointer,description:getValueFromMdParsedExtension(r,"description"),externalDocs:r.externalDocs,deprecated:!!r.deprecated,httpVerb:r.httpVerb,operationId:r.operationId,path:r.pathName,isWebhook:l,isCallback:Boolean(null==s?void 0:s.isCallback),isEvent:(null==s?void 0:s.isCallback)||l,name:getOperationName(r),defaultExampleName:r.defaultSampleName,[REDOCLY_TEAMS_RBAC]:r[REDOCLY_TEAMS_RBAC]||(null==t?void 0:t[REDOCLY_TEAMS_RBAC]),type:"operation",callbackId:null==s?void 0:s.id,href:i,get callbacks(){return Object.keys(r.callbacks||[]).map((s=>{var a;return getCallback(e,s,null===(a=r.callbacks)||void 0===a?void 0:a[s],p.pointer,o,i,t)}))},get responses(){let t=!1;return Object.keys(r.responses||[]).filter((e=>"default"===e||("success"===getStatusCodeType(e)&&(t=!0),isStatusCode(e)))).map((i=>getResponse({parser:e,code:i,defaultAsError:t,infoOrRef:r.responses[i],options:o,isEvent:p.isEvent,operation:p})))},get parameters(){let t=mergeParams(e,r.pathParameters,r.parameters,{pathPointer:JsonPointer.dirName(p.pointer),operationPointer:p.pointer}).map((({paramOrRef:r,pointer:t})=>getField(e,r,t,o,{operation:p,type:"request"})));return o.sortRequiredPropsFirst&&(t=sortByRequired(t)),sortByDeprecated(t)}};if(null==s?void 0:s.isCallback)p.security=(Array.isArray(r.security)?r.security:[]).map((r=>getSecurityRequirement({requirement:r,parser:e}))),p.servers=normalizeServers("",r.servers||r.pathServers||[]),p.id=removeLeadingSlash(i);else{p.id=getOperationId(r,t),p.href=p.href||getHref(p);const i=r.security||e.definition.security;p.security=(Array.isArray(i)?i:[]).map((r=>getSecurityRequirement({requirement:r,parser:e}))),p.servers=normalizeServers(e.definitionUrl,mergeInMockServer(r.servers||r.pathServers||e.definition.servers||[],o.mockServer))}o.showExtensions&&(p.extensions=extractExtensions(r,o.showExtensions)),p.requestBody=r.requestBody&&getRequestBody({parser:e,infoOrRef:r.requestBody,options:o,operation:p,isEvent:p.isEvent});const d=null===(a=p.requestBody)||void 0===a?void 0:a.content;return p.payload={lang:"Payload",source:"",requestBodyContent:(null==d?void 0:d.hasSample)?d:void 0},p.definitionSamples=r["x-codeSamples"]||[],p.badges=(null===(n=r["x-badges"])||void 0===n?void 0:n.map((({name:e,color:r,position:t})=>({name:e,color:r||"var(--color-info-base)",position:t||"after"}))))||[],p.hasSamples=(null==d?void 0:d.hasSample)||p.definitionSamples.length>0,p.hideReplay=!0===r["x-hideReplay"],p}export function mergeInMockServer(e,r){if(!r)return e;const t={url:r.url,description:r.description};switch(r.position){case"first":return[t,...e];case"last":return[...e,t];case"replace":return[t];default:return e}}
2
2
  //# sourceMappingURL=operation.js.map
@@ -1,2 +1,2 @@
1
- var __rest=this&&this.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};import{isObject}from"@redocly/theme";import{pushRef}from"../services/OpenAPIParser";import{detectType,extractExtensions,getValueFromMdParsedExtension,humanizeConstraints,isNamedDefinition,isPrimitiveType,JsonPointer,pluralizeType,sortByDeprecated,sortByRequired}from"../utils";import{getField}from"./field";export function getSchema({parser:e,schemaOrRef:t,pointer:i,options:r,isChild:n=!1,baseRefsStack:s=[],deps:o,absolutePointer:a}){var l,p,d,m,c,f,y,u,O;const{resolved:h,refsStack:v}=e.deref(t,s,!0),b=t.$ref||i||a||"",P=pushRef(v,b),g=e.mergeAllOf(h,b,P,t.$ref||a),x=g.type||detectType(g),F={operationPointer:(null===(l=o.operation)||void 0===l?void 0:l.pointer)||a||"",schemaOrRef:t,isChild:n,typePrefix:"",pointer:b,absolutePointer:a,refsStack:P,rawSchema:h,type:x,isCircular:!!g["x-circular-ref"],title:g.title||isNamedDefinition(b)&&JsonPointer.baseName(b)||"",description:getValueFromMdParsedExtension(g,"description")||"",format:g.format,enum:g.enum||[],example:g.example,deprecated:!!g.deprecated,pattern:g.pattern,externalDocs:g.externalDocs,displayFormat:g.format,isPrimitive:isPrimitiveType(g,x),constraints:humanizeConstraints(g),default:g.default,readOnly:!!g.readOnly,writeOnly:!!g.writeOnly,const:g.const||"",contentEncoding:g.contentEncoding,contentMediaType:g.contentMediaType,minItems:g.minItems,maxItems:g.maxItems,nullable:g.nullable||g["x-nullable"],schema:g,displayType:"",items:void 0,extensions:void 0,oneOfType:"",discriminatorProp:void 0,oneOf:void 0,"x-enumDescriptions":getValueFromMdParsedExtension(g,"x-enumDescriptions"),get fields(){if(hasType(F,"object")||hasType(F,"array")&&(Array.isArray(g.items)||Array.isArray(g.prefixItems)))return buildFields(e,g,b,r,P,o)}};if((g.nullable||g["x-nullable"])&&(Array.isArray(F.type)&&!F.type.some((e=>null===e||"null"===e))?F.type=[...F.type,"null"]:Array.isArray(F.type)||null===F.type&&"null"===F.type||(F.type=[F.type,"null"])),F.displayType=Array.isArray(F.type)?F.type.map((e=>null===e?"null":e)).join(" or "):F.type,F.isCircular)return F;if(g.if&&g.then||g.if&&g.else){const{oneOf:t,oneOfType:i}=initConditionalOperators({schema:g,parser:e,pointer:b,options:r,deps:o,refsStack:P});return F.oneOf=t,F.oneOfType=i,F}if(!n&&void 0!==getDiscriminator(g)){const{oneOf:t,discriminatorProp:i}=initDiscriminator({schema:g,parser:e,deps:o,mergedSchema:g,options:r,pointer:b,refsStack:P});return F.oneOf=t,F.discriminatorProp=i,F}if(n&&Array.isArray(g.oneOf)&&g.oneOf.find((e=>e.$ref===b))&&delete g.oneOf,void 0!==g.oneOf){const{oneOf:t,displayType:i}=initOneOf({schemaOneOf:g.oneOf,parser:e,deps:o,options:r,pointer:b,refsStack:P,schema:g});return F.oneOfType="One of",t&&(F.oneOf=t),F.displayType=i,void 0!==g.anyOf&&console.warn(`oneOf and anyOf are not supported on the same level. Skipping anyOf at ${b}`),F}if(void 0!==g.anyOf){const{oneOf:t,displayType:i}=initOneOf({schemaOneOf:g.anyOf,parser:e,deps:o,options:r,pointer:b,refsStack:P,schema:g});return t&&(F.oneOf=t),F.displayType=i,F.oneOfType="Any of",F}if(hasType(F,"array")&&(g.items&&(F.items=getSchema({parser:e,schemaOrRef:g.items,pointer:b+"/items",options:r,baseRefsStack:P,deps:o,absolutePointer:JsonPointer.join(g.absolutePointer||"",["items"])})),F.displayType=g.prefixItems||Array.isArray(g.items)?"items":pluralizeType((null===(p=F.items)||void 0===p?void 0:p.displayType)||F.displayType),F.displayFormat=(null===(d=F.items)||void 0===d?void 0:d.format)||"",F.typePrefix=(null===(m=F.items)||void 0===m?void 0:m.typePrefix)||"Array of ",F.title=F.title||(null===(c=F.items)||void 0===c?void 0:c.title)||"",F.isPrimitive=void 0!==(null===(f=F.items)||void 0===f?void 0:f.isPrimitive)?null===(y=F.items)||void 0===y?void 0:y.isPrimitive:F.isPrimitive,void 0===F.example&&void 0!==(null===(u=F.items)||void 0===u?void 0:u.example)&&(F.example=[F.items.example]),(null===(O=F.items)||void 0===O?void 0:O.isPrimitive)&&(F.enum=F.items.enum,F["x-enumDescriptions"]=getValueFromMdParsedExtension(F.items,"x-enumDescriptions")),Array.isArray(F.type))){const e=F.type.filter((e=>"array"!==e));e.length&&(F.displayType+=` or ${e.join(" or ")}`)}return r.showExtensions&&(F.extensions=extractExtensions(g,r.showExtensions)),F}function initDiscriminator({schema:e,parser:t,pointer:i,options:r,refsStack:n,deps:s,mergedSchema:o}){const a=getDiscriminator(e),l=null==a?void 0:a.propertyName,p=t.findDerived([...o["x-parentRefs"]||[],i]);if(e.oneOf)for(const t of e.oneOf){if(void 0===t.$ref)continue;const e=JsonPointer.baseName(t.$ref);p[t.$ref]=e}const d=(null==a?void 0:a.mapping)||{};let m=(null==a?void 0:a["x-explicitMappingOnly"])||!1;0===Object.keys(d).length&&(m=!1);const c={};for(const e in d){const t=d[e];Array.isArray(c[t])?c[t].push(e):c[t]=[e]}const f=m?Object.assign({},c):Object.assign(Object.assign({},p),c);let y=[];for(const e of Object.keys(f)){const t=f[e];if(Array.isArray(t))for(const i of t)y.push({$ref:e,name:i});else y.push({$ref:e,name:t})}const u=Object.keys(d);0!==u.length&&(y=y.sort(((e,t)=>{const i=u.indexOf(e.name),r=u.indexOf(t.name);return i<0&&r<0?e.name.localeCompare(t.name):i<0?1:r<0?-1:i-r})));return{oneOf:y.map((({$ref:e,name:i},a)=>{const l=getSchema({parser:t,schemaOrRef:{$ref:e},pointer:e,options:r,isChild:!0,baseRefsStack:n.slice(0,-1),deps:Object.assign(Object.assign({},s),{parentFieldFullPath:s.parentFieldFullPath?s.parentFieldFullPath+"&d="+a:"&d="+a.toString()}),absolutePointer:o.absolutePointer});return l.title=i,l})),discriminatorProp:l}}function initOneOf({schemaOneOf:e,parser:t,refsStack:i,pointer:r,schema:n,options:s,deps:o}){const a=e.map(((e,a)=>{const{resolved:l,refsStack:p}=t.deref(e,i,!0),d=t.mergeAllOf(l,r+"/oneOf/"+a,p),m=isNamedDefinition(e.$ref)&&!d.title?JsonPointer.baseName(e.$ref):`${d.title||""}${d.const&&JSON.stringify(d.const)||""}`;return getSchema({parser:t,schemaOrRef:Object.assign(Object.assign({},d),{title:m,allOf:[Object.assign(Object.assign({},n),{oneOf:void 0,anyOf:void 0})],discriminator:l.allOf?void 0:d.discriminator}),pointer:e.$ref||r+"/oneOf/"+a,options:s,baseRefsStack:p,deps:Object.assign(Object.assign({},o),{parentFieldFullPath:o.parentFieldFullPath?o.parentFieldFullPath+"&oneOf="+a:"&oneOf="+a.toString()})})})),l=a.map((e=>{let t=e.typePrefix+(e.title?`${e.title} (${e.displayType})`:e.displayType);return t.indexOf(" or ")>-1&&(t=`(${t})`),t})).join(" or ");return{oneOf:a,displayType:l}}function initConditionalOperators({schema:e,parser:t,pointer:i,options:r,refsStack:n,deps:s}){const{if:o,else:a={},then:l={}}=e,p=__rest(e,["if","else","then"]);return{oneOf:[{allOf:[p,l,o],title:o&&o["x-displayName"]||(null==o?void 0:o.title)||"case 1"},{allOf:[p,a],title:a&&a["x-displayName"]||(null==a?void 0:a.title)||"case 2"}].map(((e,o)=>getSchema({parser:t,schemaOrRef:Object.assign({},e),pointer:i+"/oneOf/"+o,options:r,baseRefsStack:n,deps:Object.assign(Object.assign({},s),{parentFieldFullPath:s.parentFieldFullPath?s.parentFieldFullPath+"&oneOf="+o:"&oneOf="+o.toString()})}))),oneOfType:"One of"}}function normalizeField(e,t,i){return e||(console.warn(`Field "${t}" is invalid, skipping.\n Field must be an object but got ${typeof e} at "${i}"`),{})}function buildFields(e,t,i,r,n,s){let o=t.properties||(hasType(t,"array")?t.prefixItems||t.items:void 0)||{};const a=t.patternProperties||{},l=t.additionalProperties||t.unevaluatedProperties,p=t.prefixItems?t.items:t.additionalItems,d=t.default||{};let m=Object.keys(o).map((a=>{var l;const p=normalizeField(o[a],a,i),m=void 0!==t.required&&t.required.indexOf(a)>-1;return getField(e,{name:t.properties?a:`[${a}]`,required:m,schema:Object.assign(Object.assign({},p),{example:(null===(l=t.example)||void 0===l?void 0:l[a])||p.example,default:void 0===p.default&&d?d[a]:p.default})},i+"/properties/"+a,r,s,n,JsonPointer.join(t.absolutePointer||"",["properties",a]))}));return r.sortRequiredPropsFirst&&(m=sortByRequired(m,t.required)),m.push(...Object.keys(a).map((t=>{const o=normalizeField(a[t],t,i);return getField(e,{name:t,required:!1,schema:o,kind:"patternProperties"},`${i}/patternProperties/${t}`,r,s,n)}))),(isObject(l)||!0===l)&&m.push(getField(e,{name:(isObject(l)&&l["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===l?{}:l,kind:"additionalProperties"},i+"/additionalProperties",r,s,n,JsonPointer.join(t.absolutePointer||"",["additionalProperties"]))),m.push(...buildAdditionalItems({parser:e,schema:p,fieldsCount:m.length,$ref:i,options:r,refsStack:n,deps:s})),sortByDeprecated(m)}function buildAdditionalItems({parser:e,schema:t=!1,fieldsCount:i,$ref:r,options:n,refsStack:s,deps:o}){return"boolean"==typeof t?t?[getField(e,{name:`[${i}...]`,schema:{},kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]:Array.isArray(t)?[...t.map(((t,a)=>getField(e,{name:`[${i+a}]`,schema:t,kind:"additionalItems"},`${r}/additionalItems/${a}`,n,o,s)))]:isObject(t)?[getField(e,{name:`[${i}...]`,schema:t,kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function hasType(e,t){return e.type===t||Array.isArray(e.type)&&e.type.includes(t)}
1
+ var __rest=this&&this.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};import{isObject}from"@redocly/theme";import{REDOCLY_TEAMS_RBAC}from"@redocly/config";import{pushRef}from"../services/OpenAPIParser";import{detectType,extractExtensions,getValueFromMdParsedExtension,humanizeConstraints,isNamedDefinition,isPrimitiveType,JsonPointer,pluralizeType,sortByDeprecated,sortByRequired}from"../utils";import{getField}from"./field";export function getSchema({parser:e,schemaOrRef:t,pointer:i,options:r,isChild:n=!1,baseRefsStack:s=[],deps:o,absolutePointer:a}){var l,p,d,m,c,f,y,u,O;const{resolved:h,refsStack:v}=e.deref(t,s,!0),b=t.$ref||i||a||"",P=pushRef(v,b),g=e.mergeAllOf(h,b,P,t.$ref||a),x=g.type||detectType(g),F={operationPointer:(null===(l=o.operation)||void 0===l?void 0:l.pointer)||a||"",schemaOrRef:t,isChild:n,typePrefix:"",pointer:b,absolutePointer:a,refsStack:P,rawSchema:h,type:x,isCircular:!!g["x-circular-ref"],title:g.title||isNamedDefinition(b)&&JsonPointer.baseName(b)||"",description:getValueFromMdParsedExtension(g,"description")||"",format:g.format,enum:g.enum||[],example:g.example,deprecated:!!g.deprecated,pattern:g.pattern,externalDocs:g.externalDocs,displayFormat:g.format,isPrimitive:isPrimitiveType(g,x),constraints:humanizeConstraints(g),default:g.default,readOnly:!!g.readOnly,writeOnly:!!g.writeOnly,const:g.const||"",contentEncoding:g.contentEncoding,contentMediaType:g.contentMediaType,minItems:g.minItems,maxItems:g.maxItems,nullable:g.nullable||g["x-nullable"],schema:g,displayType:"",items:void 0,extensions:void 0,oneOfType:"",discriminatorProp:void 0,oneOf:void 0,[REDOCLY_TEAMS_RBAC]:g[REDOCLY_TEAMS_RBAC],"x-enumDescriptions":getValueFromMdParsedExtension(g,"x-enumDescriptions"),get fields(){if(hasType(F,"object")||hasType(F,"array")&&(Array.isArray(g.items)||Array.isArray(g.prefixItems)))return buildFields(e,g,b,r,P,o)}};if((g.nullable||g["x-nullable"])&&(Array.isArray(F.type)&&!F.type.some((e=>null===e||"null"===e))?F.type=[...F.type,"null"]:Array.isArray(F.type)||null===F.type&&"null"===F.type||(F.type=[F.type,"null"])),F.displayType=Array.isArray(F.type)?F.type.map((e=>null===e?"null":e)).join(" or "):F.type,F.isCircular)return F;if(g.if&&g.then||g.if&&g.else){const{oneOf:t,oneOfType:i}=initConditionalOperators({schema:g,parser:e,pointer:b,options:r,deps:o,refsStack:P});return F.oneOf=t,F.oneOfType=i,F}if(!n&&void 0!==getDiscriminator(g)){const{oneOf:t,discriminatorProp:i}=initDiscriminator({schema:g,parser:e,deps:o,mergedSchema:g,options:r,pointer:b,refsStack:P});return F.oneOf=t,F.discriminatorProp=i,F}if(n&&Array.isArray(g.oneOf)&&g.oneOf.find((e=>e.$ref===b))&&delete g.oneOf,void 0!==g.oneOf){const{oneOf:t,displayType:i}=initOneOf({schemaOneOf:g.oneOf,parser:e,deps:o,options:r,pointer:b,refsStack:P,schema:g});return F.oneOfType="One of",t&&(F.oneOf=t),F.displayType=i,void 0!==g.anyOf&&console.warn(`oneOf and anyOf are not supported on the same level. Skipping anyOf at ${b}`),F}if(void 0!==g.anyOf){const{oneOf:t,displayType:i}=initOneOf({schemaOneOf:g.anyOf,parser:e,deps:o,options:r,pointer:b,refsStack:P,schema:g});return t&&(F.oneOf=t),F.displayType=i,F.oneOfType="Any of",F}if(hasType(F,"array")&&(g.items&&(F.items=getSchema({parser:e,schemaOrRef:g.items,pointer:b+"/items",options:r,baseRefsStack:P,deps:o,absolutePointer:JsonPointer.join(g.absolutePointer||"",["items"])})),F.displayType=g.prefixItems||Array.isArray(g.items)?"items":pluralizeType((null===(p=F.items)||void 0===p?void 0:p.displayType)||F.displayType),F.displayFormat=(null===(d=F.items)||void 0===d?void 0:d.format)||"",F.typePrefix=(null===(m=F.items)||void 0===m?void 0:m.typePrefix)||"Array of ",F.title=F.title||(null===(c=F.items)||void 0===c?void 0:c.title)||"",F.isPrimitive=void 0!==(null===(f=F.items)||void 0===f?void 0:f.isPrimitive)?null===(y=F.items)||void 0===y?void 0:y.isPrimitive:F.isPrimitive,void 0===F.example&&void 0!==(null===(u=F.items)||void 0===u?void 0:u.example)&&(F.example=[F.items.example]),(null===(O=F.items)||void 0===O?void 0:O.isPrimitive)&&(F.enum=F.items.enum,F["x-enumDescriptions"]=getValueFromMdParsedExtension(F.items,"x-enumDescriptions")),Array.isArray(F.type))){const e=F.type.filter((e=>"array"!==e));e.length&&(F.displayType+=` or ${e.join(" or ")}`)}return r.showExtensions&&(F.extensions=extractExtensions(g,r.showExtensions)),F}function initDiscriminator({schema:e,parser:t,pointer:i,options:r,refsStack:n,deps:s,mergedSchema:o}){const a=getDiscriminator(e),l=null==a?void 0:a.propertyName,p=t.findDerived([...o["x-parentRefs"]||[],i]);if(e.oneOf)for(const t of e.oneOf){if(void 0===t.$ref)continue;const e=JsonPointer.baseName(t.$ref);p[t.$ref]=e}const d=(null==a?void 0:a.mapping)||{};let m=(null==a?void 0:a["x-explicitMappingOnly"])||!1;0===Object.keys(d).length&&(m=!1);const c={};for(const e in d){const t=d[e];Array.isArray(c[t])?c[t].push(e):c[t]=[e]}const f=m?Object.assign({},c):Object.assign(Object.assign({},p),c);let y=[];for(const e of Object.keys(f)){const t=f[e];if(Array.isArray(t))for(const i of t)y.push({$ref:e,name:i});else y.push({$ref:e,name:t})}const u=Object.keys(d);0!==u.length&&(y=y.sort(((e,t)=>{const i=u.indexOf(e.name),r=u.indexOf(t.name);return i<0&&r<0?e.name.localeCompare(t.name):i<0?1:r<0?-1:i-r})));return{oneOf:y.map((({$ref:e,name:i},a)=>{const l=getSchema({parser:t,schemaOrRef:{$ref:e},pointer:e,options:r,isChild:!0,baseRefsStack:n.slice(0,-1),deps:Object.assign(Object.assign({},s),{parentFieldFullPath:s.parentFieldFullPath?s.parentFieldFullPath+"&d="+a:"&d="+a.toString()}),absolutePointer:o.absolutePointer});return l.title=i,l})),discriminatorProp:l}}function initOneOf({schemaOneOf:e,parser:t,refsStack:i,pointer:r,schema:n,options:s,deps:o}){const a=e.map(((e,a)=>{const{resolved:l,refsStack:p}=t.deref(e,i,!0),d=t.mergeAllOf(l,r+"/oneOf/"+a,p),m=isNamedDefinition(e.$ref)&&!d.title?JsonPointer.baseName(e.$ref):`${d.title||""}${d.const&&JSON.stringify(d.const)||""}`;return getSchema({parser:t,schemaOrRef:Object.assign(Object.assign({},d),{title:m,allOf:[Object.assign(Object.assign({},n),{oneOf:void 0,anyOf:void 0})],discriminator:l.allOf?void 0:d.discriminator}),pointer:e.$ref||r+"/oneOf/"+a,options:s,baseRefsStack:p,deps:Object.assign(Object.assign({},o),{parentFieldFullPath:o.parentFieldFullPath?o.parentFieldFullPath+"&oneOf="+a:"&oneOf="+a.toString()})})})),l=a.map((e=>{let t=e.typePrefix+(e.title?`${e.title} (${e.displayType})`:e.displayType);return t.indexOf(" or ")>-1&&(t=`(${t})`),t})).join(" or ");return{oneOf:a,displayType:l}}function initConditionalOperators({schema:e,parser:t,pointer:i,options:r,refsStack:n,deps:s}){const{if:o,else:a={},then:l={}}=e,p=__rest(e,["if","else","then"]);return{oneOf:[{allOf:[p,l,o],title:o&&o["x-displayName"]||(null==o?void 0:o.title)||"case 1"},{allOf:[p,a],title:a&&a["x-displayName"]||(null==a?void 0:a.title)||"case 2"}].map(((e,o)=>getSchema({parser:t,schemaOrRef:Object.assign({},e),pointer:i+"/oneOf/"+o,options:r,baseRefsStack:n,deps:Object.assign(Object.assign({},s),{parentFieldFullPath:s.parentFieldFullPath?s.parentFieldFullPath+"&oneOf="+o:"&oneOf="+o.toString()})}))),oneOfType:"One of"}}function normalizeField(e,t,i){return e||(console.warn(`Field "${t}" is invalid, skipping.\n Field must be an object but got ${typeof e} at "${i}"`),{})}function buildFields(e,t,i,r,n,s){let o=t.properties||(hasType(t,"array")?t.prefixItems||t.items:void 0)||{};const a=t.patternProperties||{},l=t.additionalProperties||t.unevaluatedProperties,p=t.prefixItems?t.items:t.additionalItems,d=t.default||{};let m=Object.keys(o).map((a=>{var l;const p=normalizeField(o[a],a,i),m=void 0!==t.required&&t.required.indexOf(a)>-1;return getField(e,{name:t.properties?a:`[${a}]`,required:m,schema:Object.assign(Object.assign({},p),{example:(null===(l=t.example)||void 0===l?void 0:l[a])||p.example,default:void 0===p.default&&d?d[a]:p.default})},i+"/properties/"+a,r,s,n,JsonPointer.join(t.absolutePointer||"",["properties",a]))}));return r.sortRequiredPropsFirst&&(m=sortByRequired(m,t.required)),m.push(...Object.keys(a).map((t=>{const o=normalizeField(a[t],t,i);return getField(e,{name:t,required:!1,schema:o,kind:"patternProperties"},`${i}/patternProperties/${t}`,r,s,n)}))),(isObject(l)||!0===l)&&m.push(getField(e,{name:(isObject(l)&&l["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===l?{}:l,kind:"additionalProperties"},i+"/additionalProperties",r,s,n,JsonPointer.join(t.absolutePointer||"",["additionalProperties"]))),m.push(...buildAdditionalItems({parser:e,schema:p,fieldsCount:m.length,$ref:i,options:r,refsStack:n,deps:s})),sortByDeprecated(m)}function buildAdditionalItems({parser:e,schema:t=!1,fieldsCount:i,$ref:r,options:n,refsStack:s,deps:o}){return"boolean"==typeof t?t?[getField(e,{name:`[${i}...]`,schema:{},kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]:Array.isArray(t)?[...t.map(((t,a)=>getField(e,{name:`[${i+a}]`,schema:t,kind:"additionalItems"},`${r}/additionalItems/${a}`,n,o,s)))]:isObject(t)?[getField(e,{name:`[${i}...]`,schema:t,kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function hasType(e,t){return e.type===t||Array.isArray(e.type)&&e.type.includes(t)}
2
2
  //# sourceMappingURL=schema.js.map
@@ -1,3 +1,4 @@
1
+ import type { REDOCLY_TEAMS_RBAC } from '@redocly/config';
1
2
  import type { Node } from '@markdoc/markdoc';
2
3
  import type { OpenAPISecurityScheme, OpenAPIEncoding, OpenAPIMediaType, OpenAPIParameterLocation, OpenAPIParameterStyle, OpenAPIExternalDocumentation, OpenAPIServer, OpenAPIXCodeSample, OpenAPIXBadges, OpenAPISchema, Referenced, OpenAPIInfo } from '../types';
3
4
  import type { OpenAPIParser } from '../services/OpenAPIParser';
@@ -104,6 +105,7 @@ export type FieldModel = {
104
105
  fieldFullPath?: string;
105
106
  deps: Deps;
106
107
  absolutePointer?: string;
108
+ [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
107
109
  };
108
110
  export type CallbackModel = {
109
111
  name: string;
@@ -162,6 +164,7 @@ export type GroupModel = {
162
164
  infoDefinition?: OpenAPIInfo;
163
165
  depth: number;
164
166
  level: number;
167
+ [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
165
168
  };
166
169
  export type OperationMenuItem = {
167
170
  id: string;
@@ -178,6 +181,7 @@ export type OperationMenuItem = {
178
181
  isWebhook: boolean;
179
182
  operationId?: string;
180
183
  badges?: OpenAPIXBadges[];
184
+ [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
181
185
  };
182
186
  export type SchemaModel = {
183
187
  operationPointer: string;
@@ -221,6 +225,7 @@ export type SchemaModel = {
221
225
  contentMediaType?: string;
222
226
  minItems?: number;
223
227
  maxItems?: number;
228
+ [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
224
229
  };
225
230
  export type Deps = {
226
231
  parentFieldFullPath?: string;
@@ -2004,6 +2004,52 @@ export declare const source: {
2004
2004
  };
2005
2005
  fullUrl: string;
2006
2006
  };
2007
+ "POST http://petstore.swagger.io/v2/uploadImage": {
2008
+ httpVersion: string;
2009
+ queryString: never[];
2010
+ basicAuth: {
2011
+ username: string;
2012
+ password: string;
2013
+ };
2014
+ headersSize: number;
2015
+ bodySize: number;
2016
+ securityOAuth2ExtraCalls: never[];
2017
+ pathParameters: {};
2018
+ queryObj: {};
2019
+ headersObj: {};
2020
+ cookiesObj: {};
2021
+ allHeaders: {};
2022
+ serverVariables: {};
2023
+ cookies: {
2024
+ name: string;
2025
+ value: string;
2026
+ }[];
2027
+ uriObj: {
2028
+ protocol: string;
2029
+ slashes: boolean;
2030
+ auth: null;
2031
+ host: string;
2032
+ port: null;
2033
+ hostname: string;
2034
+ hash: null;
2035
+ search: string;
2036
+ query: {};
2037
+ pathname: string;
2038
+ path: string;
2039
+ href: string;
2040
+ };
2041
+ fullUrl: string;
2042
+ method: string;
2043
+ url: string;
2044
+ headers: never[];
2045
+ postData: {
2046
+ mimeType: string;
2047
+ params: {
2048
+ name: string;
2049
+ value: string;
2050
+ }[];
2051
+ };
2052
+ };
2007
2053
  };
2008
2054
  export declare const serverVariablesOptions: {
2009
2055
  withImports: boolean;
@@ -1,2 +1,2 @@
1
- const spec={openapi:"3.0.0",servers:[{url:"//petstore.swagger.io/v2",description:"Default server"},{url:"//petstore.swagger.io/sandbox",description:"Sandbox server"}],info:{description:"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n# Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n# OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Subheader 1\n\nConsectetur adipiscing elit. Etiam fringilla tincidunt magna non dignissim. Vestibulum vestibulum ipsum augue, sed rhoncus diam consequat sodales. Sed facilisis maximus enim, ut scelerisque lorem ullamcorper eget. Suspendisse venenatis non lectus sed bibendum.\n*Duis neque ante, ultrices at ornare aliquam, vulputate ac dolor.*\n\n## Subheader 2\n\nLorem ipsum dolor sit amet. Ut tempor sem vitae dui varius, consequat varius ligula fringilla. Nulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vulputate pulvinar turpis, ac convallis quam.\n\n# Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n# Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n",version:"1.0.0",title:"Swagger Petstore",termsOfService:"http://swagger.io/terms/",contact:{name:"API Support",email:"apiteam@swagger.io",url:"https://github.com/Redocly/redoc"},"x-logo":{url:"https://redocly.github.io/redoc/petstore-logo.png",altText:"Petstore logo"},license:{name:"Apache 2.0",url:"http://www.apache.org/licenses/LICENSE-2.0.html"}},externalDocs:{description:"Find out how to create Github repo for your OpenAPI spec.",url:"https://github.com/Rebilly/generator-openapi-repo"},tags:[{name:"pet",description:"Lorem ipsum dolor sit amet.\n\n**Consectetur** adipiscing elit. Etiam fringilla tincidunt magna non dignissim. Vestibulum vestibulum ipsum augue, sed rhoncus diam consequat sodales. Sed facilisis maximus enim, ut scelerisque lorem ullamcorper eget. Suspendisse venenatis non lectus sed bibendum.\n*Duis neque ante, ultrices at ornare aliquam, vulputate ac dolor.*\n\nPellentesque nulla lorem:\n- dapibus lacinia magna vitae, \n- eleifend bibendum nisi\n\nNullam pretium erat ut augue mollis, id varius orci pretium. \n> Ut efficitur eget dui eget molestie.\n\nUt tempor sem vitae dui varius, consequat varius ligula fringilla. Nulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vulputate pulvinar turpis, ac convallis quam.\n[More info](http://swagger.io)\n"},{name:"store"},{name:"user",description:"Operations about user\n\n## Custom section 1\nNullam pretium erat ut augue mollis, id varius orci pretium. \n\n\n## Custom section 2\nNulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nSome Item\n"},{name:"pet_model","x-displayName":"The Pet Model",description:'<SchemaDefinition schemaRef="#/components/schemas/Pet" />\n'},{name:"store_model","x-displayName":"The Order Model",description:'<SchemaDefinition schemaRef="#/components/schemas/Order" exampleRef="#/components/examples/Order" showReadOnly={true} showWriteOnly={true} />\n'}],"x-tagGroups":[{name:"General",tags:["pet","store"]},{name:"User Management",tags:["user"]},{name:"Models",tags:["pet_model","store_model"]}],paths:{"/pet":{parameters:[{name:"Accept-Language",in:"header",description:"The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US",example:"en-US",required:!1,schema:{type:"string",default:"en-AU"}},{name:"cookieParam",in:"cookie",description:"Some cookie",required:!0,schema:{type:"integer",format:"int64"}}],post:{tags:["pet"],summary:"Add a new pet to the store",description:"Add new pet to the store inventory.",operationId:"addPet",responses:{405:{description:"Invalid input"}},security:[{petstore_auth:["write:pets","read:pets"]}],"x-codeSamples":[{lang:"C#",source:'PetStore.v1.Pet pet = new PetStore.v1.Pet();\npet.setApiKey("your api key");\npet.petType = PetStore.v1.Pet.TYPE_DOG;\npet.name = "Rex";\n// set other fields\nPetStoreResponse response = pet.create();\nif (response.statusCode == HttpStatusCode.Created)\n{\n // Successfully created\n}\nelse\n{\n // Something wrong -- check response for errors\n Console.WriteLine(response.getRawResponse());\n}\n'},{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->create($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}],requestBody:{$ref:"#/components/requestBodies/Pet"}},put:{tags:["pet"],summary:"Update an existing pet",description:"",operationId:"updatePet",responses:{400:{description:"Invalid ID supplied"},404:{description:"Pet not found"},405:{description:"Validation exception"}},security:[{petstore_auth:["write:pets","read:pets"]}],"x-codeSamples":[{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetId(1);\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->update($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}],requestBody:{$ref:"#/components/requestBodies/Pet"}}},"/pet/{petId}":{get:{tags:["pet"],summary:"Find pet by ID",description:"Returns a single pet",operationId:"getPetById",parameters:[{name:"petId",in:"path",description:"ID of pet to return",required:!0,deprecated:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Pet"}},"application/xml":{schema:{$ref:"#/components/schemas/Pet"}}}},400:{description:"Invalid ID supplied"},404:{description:"Pet not found"}},security:[{api_key:[]}]},post:{tags:["pet"],summary:"Updates a pet in the store with form data",description:"",operationId:"updatePetWithForm",parameters:[{name:"petId",in:"path",description:"ID of pet that needs to be updated",required:!0,schema:{type:"integer",format:"int64"}}],responses:{405:{description:"Invalid input"}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/x-www-form-urlencoded":{schema:{type:"object",properties:{name:{description:"Updated name of the pet",type:"string"},status:{description:"Updated status of the pet",type:"string"}}}}}}},delete:{tags:["pet"],summary:"Deletes a pet",description:"",operationId:"deletePet",parameters:[{name:"api_key",in:"header",required:!1,schema:{type:"string"},example:"Bearer <TOKEN>"},{name:"petId",in:"path",description:"Pet id to delete",required:!0,schema:{type:"integer",format:"int64"}}],responses:{400:{description:"Invalid pet value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{post:{tags:["pet"],summary:"uploads an image",description:"",operationId:"uploadFile",parameters:[{name:"petId",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/ApiResponse"}}}}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/octet-stream":{schema:{type:"string",format:"binary"}}}}}},"/pet/{petId}/uploadImage/{data}":{post:{tags:["pet"],summary:"uploads an image",description:"",operationId:"uploadFile",parameters:[{name:"petId",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}},{name:"data",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/ApiResponse"}}}}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/octet-stream":{schema:{type:"string",format:"binary"}}}}}},"/pet/findByStatus":{get:{tags:["pet"],summary:"Finds Pets by status",description:"Multiple status values can be provided with comma separated strings",operationId:"findPetsByStatus",parameters:[{name:"status",in:"query",description:"Status values that need to be considered for filter",required:!0,style:"form",schema:{type:"array",minItems:1,maxItems:3,items:{type:"string",enum:["available","pending","sold"],default:"available"}}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}},"application/xml":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}}}},400:{description:"Invalid status value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/pet/findByTags":{get:{tags:["pet"],summary:"Finds Pets by tags",description:"Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",operationId:"findPetsByTags",deprecated:!0,parameters:[{name:"tags",in:"query",description:"Tags to filter by",required:!0,style:"form",schema:{type:"array",items:{type:"string"}}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}},"application/xml":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}}}},400:{description:"Invalid tag value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/store/inventory":{get:{tags:["store"],summary:"Returns pet inventories by status",description:"Returns a map of status codes to quantities",operationId:"getInventory",responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"object",additionalProperties:{type:"integer",format:"int32"}}}}}},security:[{api_key:[]}]}},"/store/order":{post:{tags:["store"],summary:"Place an order for a pet",description:"",operationId:"placeOrder",responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}},"application/xml":{schema:{$ref:"#/components/schemas/Order"}}}},400:{description:"Invalid Order",content:{"application/json":{example:{status:400,message:"Invalid Order"}}}}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}}},description:"order placed for purchasing the pet",required:!0}}},"/store/order/{orderId}":{get:{tags:["store"],summary:"Find purchase order by ID",description:"For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",operationId:"getOrderById",parameters:[{name:"orderId",in:"path",description:"ID of pet that needs to be fetched",required:!0,schema:{type:"integer",format:"int64",minimum:1,maximum:5}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}},"application/xml":{schema:{$ref:"#/components/schemas/Order"}}}},400:{description:"Invalid ID supplied"},404:{description:"Order not found"}}},delete:{tags:["store"],summary:"Delete purchase order by ID",description:"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",operationId:"deleteOrder",parameters:[{name:"orderId",in:"path",description:"ID of the order that needs to be deleted",required:!0,schema:{type:"string",minimum:1}}],responses:{400:{description:"Invalid ID supplied"},404:{description:"Order not found"}}}},"/store/subscribe":{post:{tags:["store"],summary:"Subscribe to the Store events",description:"Add subscription for a store events",requestBody:{content:{"application/json":{schema:{type:"object",properties:{callbackUrl:{type:"string",format:"uri",description:"This URL will be called by the server when the desired event will occur",example:"https://myserver.com/send/callback/here"},eventName:{type:"string",description:"Event name for the subscription",enum:["orderInProgress","orderShipped","orderDelivered"],example:"orderInProgress"}},required:["callbackUrl","eventName"]}}}},responses:{201:{description:"Subscription added",content:{"application/json":{schema:{type:"object",properties:{subscriptionId:{type:"string",example:"AAA-123-BBB-456"}}}}}}},callbacks:{orderInProgress:{"{$request.body#/callbackUrl}?event={$request.body#/eventName}":{servers:[{url:"//callback-url.path-level/v1",description:"Path level server 1"},{url:"//callback-url.path-level/v2",description:"Path level server 2"}],post:{summary:"Order in Progress (Summary)",description:'A callback triggered every time an Order is updated status to "inProgress" (Description)',externalDocs:{description:"Find out more",url:"https://more-details.com/demo"},requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},status:{type:"string",example:"inProgress"}}}},"application/xml":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"}}},example:'<?xml version="1.0" encoding="UTF-8"?>\n<root>\n <orderId>123</orderId>\n <status>inProgress</status>\n <timestamp>2018-10-19T16:46:45Z</timestamp>\n</root>\n'}}},responses:{200:{description:"Callback successfully processed and no retries will be performed",content:{"application/json":{schema:{type:"object",properties:{someProp:{type:"string",example:"123"}}}}}},299:{description:"Response for cancelling subscription"},500:{description:"Callback processing failed and retries will be performed"}},"x-codeSamples":[{lang:"C#",source:'PetStore.v1.Pet pet = new PetStore.v1.Pet();\npet.setApiKey("your api key");\npet.petType = PetStore.v1.Pet.TYPE_DOG;\npet.name = "Rex";\n// set other fields\nPetStoreResponse response = pet.create();\nif (response.statusCode == HttpStatusCode.Created)\n{\n // Successfully created\n}\nelse\n{\n // Something wrong -- check response for errors\n Console.WriteLine(response.getRawResponse());\n}\n'},{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->create($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}]},put:{description:"Order in Progress (Only Description)",servers:[{url:"//callback-url.operation-level/v1",description:"Operation level server 1 (Operation override)"},{url:"//callback-url.operation-level/v2",description:"Operation level server 2 (Operation override)"}],requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},status:{type:"string",example:"inProgress"}}}},"application/xml":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"}}},example:'<?xml version="1.0" encoding="UTF-8"?>\n<root>\n <orderId>123</orderId>\n <status>inProgress</status>\n <timestamp>2018-10-19T16:46:45Z</timestamp>\n</root>\n'}}},responses:{200:{description:"Callback successfully processed and no retries will be performed",content:{"application/json":{schema:{type:"object",properties:{someProp:{type:"string",example:"123"}}}}}}}}}},orderShipped:{"{$request.body#/callbackUrl}?event={$request.body#/eventName}":{post:{description:"Very long description\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu\nfugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in\nculpa qui officia deserunt mollit anim id est laborum.\n",requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},estimatedDeliveryDate:{type:"string",format:"date-time",example:"2018-11-11T16:00:00Z"}}}}}},responses:{200:{description:"Callback successfully processed and no retries will be performed"}}}}},orderDelivered:{"http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}":{post:{deprecated:!0,summary:"Order delivered",description:"A callback triggered every time an Order is delivered to the recipient",requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"}}}}}},responses:{200:{description:"Callback successfully processed and no retries will be performed"}}}}}}}},"/user":{post:{tags:["user"],summary:"Create user",description:"This can only be done by the logged in user.",operationId:"createUser",responses:{default:{description:"successful operation"}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/User"}}},description:"Created user object",required:!0}}},"/user/{username}":{get:{tags:["user"],summary:"Get user by user name",description:"",operationId:"getUserByName",parameters:[{name:"username",in:"path",description:"The name that needs to be fetched. Use user1 for testing. ",required:!0,schema:{type:"string"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/User"}},"application/xml":{schema:{$ref:"#/components/schemas/User"}}}},400:{description:"Invalid username supplied"},404:{description:"User not found"}}},put:{tags:["user"],summary:"Updated user",description:"This can only be done by the logged in user.",operationId:"updateUser",parameters:[{name:"username",in:"path",description:"name that need to be deleted",required:!0,schema:{type:"string"}}],responses:{400:{description:"Invalid user supplied"},404:{description:"User not found"}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/User"}}},description:"Updated user object",required:!0}},delete:{tags:["user"],summary:"Delete user",description:"This can only be done by the logged in user.",operationId:"deleteUser",parameters:[{name:"username",in:"path",description:"The name that needs to be deleted",required:!0,schema:{type:"string"}}],responses:{400:{description:"Invalid username supplied"},404:{description:"User not found"}}}},"/user/createWithArray":{post:{tags:["user"],summary:"Creates list of users with given input array",description:"",operationId:"createUsersWithArrayInput",responses:{default:{description:"successful operation"}},requestBody:{$ref:"#/components/requestBodies/UserArray"}}},"/user/createWithList":{post:{tags:["user"],summary:"Creates list of users with given input array",description:"",operationId:"createUsersWithListInput",responses:{default:{description:"successful operation"}},requestBody:{$ref:"#/components/requestBodies/UserArray"}}},"/user/login":{get:{tags:["user"],summary:"Logs user into the system",description:"",operationId:"loginUser",parameters:[{name:"username",in:"query",description:"The user name for login",required:!0,schema:{type:"string"}},{name:"password",in:"query",description:"The password for login in clear text",required:!0,schema:{type:"string"}}],responses:{200:{description:"successful operation",headers:{"X-Rate-Limit":{description:"calls per hour allowed by the user",schema:{type:"integer",format:"int32"}},"X-Expires-After":{description:"date in UTC when token expires",schema:{type:"string",format:"date-time"}}},content:{"application/json":{schema:{type:"string"},examples:{response:{value:"OK"}}},"application/xml":{schema:{type:"string"},examples:{response:{value:"<Message> OK </Message>"}}},"text/plain":{examples:{response:{value:"OK"}}}}},400:{description:"Invalid username/password supplied"}}}},"/user/logout":{get:{tags:["user"],summary:"Logs out current logged in user session",description:"",operationId:"logoutUser",responses:{default:{description:"successful operation"}}}}},components:{schemas:{ApiResponse:{type:"object",properties:{code:{type:"integer",format:"int32"},type:{type:"string"},message:{type:"string"}}},Cat:{description:"A representation of a cat",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{huntingSkill:{type:"string",description:"The measured skill for hunting",default:"lazy",example:"adventurous",enum:["clueless","lazy","adventurous","aggressive"]}},required:["huntingSkill"]}]},Category:{type:"object",properties:{id:{description:"Category ID",allOf:[{$ref:"#/components/schemas/Id"}]},name:{description:"Category name",type:"string",minLength:1},sub:{description:"Test Sub Category",type:"object",properties:{prop1:{type:"string",description:"Dumb Property"}}}},xml:{name:"Category"}},Dog:{description:"A representation of a dog",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{packSize:{type:"integer",format:"int32",description:"The size of the pack the dog is from",default:1,minimum:1}},required:["packSize"]}]},HoneyBee:{description:"A representation of a honey bee",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{honeyPerDay:{type:"number",description:"Average amount of honey produced per day in ounces",example:3.14,multipleOf:.01}},required:["honeyPerDay"]}]},Id:{type:"integer",format:"int64",readOnly:!0},Order:{type:"object",properties:{id:{description:"Order ID",allOf:[{$ref:"#/components/schemas/Id"}]},petId:{description:"Pet ID",allOf:[{$ref:"#/components/schemas/Id"}]},quantity:{type:"integer",format:"int32",minimum:1,default:1},shipDate:{description:"Estimated ship date",type:"string",format:"date-time"},status:{type:"string",description:"Order Status",enum:["placed","approved","delivered"]},complete:{description:"Indicates whenever order was completed or not",type:"boolean",default:!1,readOnly:!0},requestId:{description:"Unique Request Id",type:"string",writeOnly:!0}},xml:{name:"Order"}},Pet:{type:"object",required:["name","photoUrls"],discriminator:{propertyName:"petType",mapping:{cat:"#/components/schemas/Cat",dog:"#/components/schemas/Dog",bee:"#/components/schemas/HoneyBee"}},properties:{id:{externalDocs:{description:"Find more info here",url:"https://example.com"},description:"Pet ID",allOf:[{$ref:"#/components/schemas/Id"}]},category:{description:"Categories this pet belongs to",allOf:[{$ref:"#/components/schemas/Category"}]},name:{description:"The name given to a pet",type:"string",example:"Guru"},photoUrls:{description:"The list of URL to a cute photos featuring pet",type:"array",maxItems:20,xml:{name:"photoUrl",wrapped:!0},items:{type:"string",format:"url"}},friend:{allOf:[{$ref:"#/components/schemas/Pet"}]},tags:{description:"Tags attached to the pet",type:"array",minItems:1,xml:{name:"tag",wrapped:!0},items:{$ref:"#/components/schemas/Tag"}},status:{type:"string",description:"Pet status in the store",enum:["available","pending","sold"]},petType:{description:"Type of a pet",type:"string"}},xml:{name:"Pet"}},Tag:{type:"object",properties:{id:{description:"Tag ID",allOf:[{$ref:"#/components/schemas/Id"}]},name:{description:"Tag name",type:"string",minLength:1}},xml:{name:"Tag"}},User:{type:"object",properties:{id:{$ref:"#/components/schemas/Id"},pet:{oneOf:[{$ref:"#/components/schemas/Pet"},{$ref:"#/components/schemas/Tag"}]},username:{description:"User supplied username",type:"string",minLength:4,example:"John78"},firstName:{description:"User first name",type:"string",minLength:1,example:"John"},lastName:{description:"User last name",type:"string",minLength:1,example:"Smith"},email:{description:"User email address",type:"string",format:"email",example:"john.smith@example.com"},password:{type:"string",description:"User password, MUST contain a mix of upper and lower case letters, as well as digits",format:"password",minLength:8,pattern:"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/",example:"drowssaP123"},phone:{description:"User phone number in international format",type:"string",pattern:"/^\\+(?:[0-9]-?){6,14}[0-9]$/",example:"+1-202-555-0192"},userStatus:{description:"User status",type:"integer",format:"int32"}},xml:{name:"User"}}},requestBodies:{Pet:{content:{"application/json":{schema:{allOf:[{description:"My Pet",title:"Pettie"},{$ref:"#/components/schemas/Pet"}]}},"application/xml":{schema:{type:"object",properties:{name:{type:"string",description:"hooray"}}}}},description:"Pet object that needs to be added to the store",required:!0},UserArray:{content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/User"}}}},description:"List of user object",required:!0}},securitySchemes:{petstore_auth:{description:"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n",type:"oauth2",flows:{clientCredentials:{tokenUrl:"http://petstore.swagger.io/api/oauth/dialog",scopes:{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},api_key:{description:"For this sample, you can use the api key `special-key` to test the authorization filters.\n",type:"apiKey",name:"api_key",in:"header"}},examples:{Order:{value:{quantity:1,shipDate:"2018-10-19T16:46:45Z",status:"placed",complete:!1}}}},"x-webhooks":{newPet:{post:{summary:"New pet",description:"Information about a new pet in the systems",operationId:"newPet",tags:["pet"],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Pet"}}}},responses:{200:{description:"Return a 200 status to indicate that the data was received successfully"}}}}}};export const originalOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:spec};export const source={"POST http://petstore.swagger.io/v2/pet":{method:"post",url:"http://petstore.swagger.io/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:'{"category":{"name":"string","sub":{"prop1":"string"}},"name":"Guru","photoUrls":["string"],"friend":{},"tags":[{"name":"string"}],"status":"available","petType":"cat","huntingSkill":"adventurous"}',params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet",path:"/v2/pet",href:"http://petstore.swagger.io/v2/pet"},fullUrl:"http://petstore.swagger.io/v2/pet"},"POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}":{method:"post",url:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Content-Type",value:"application/octet-stream"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{petId:"",data:""},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet/{petId}/uploadImage/{data}",path:"/v2/pet/{petId}/uploadImage/{data}",href:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}"},fullUrl:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}"},"PUT http://petstore.swagger.io/v2/pet":{method:"put",url:"http://petstore.swagger.io/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:'{"category":{"name":"string","sub":{"prop1":"string"}},"name":"Guru","photoUrls":["string"],"friend":{},"tags":[{"name":"string"}],"status":"available","petType":"cat","huntingSkill":"adventurous"}',params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet",path:"/v2/pet",href:"http://petstore.swagger.io/v2/pet"},fullUrl:"http://petstore.swagger.io/v2/pet"},"POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage":{method:"post",url:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Content-Type",value:"application/octet-stream"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{petId:""},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet/{petId}/uploadImage",path:"/v2/pet/{petId}/uploadImage",href:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage"},fullUrl:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage"},"GET http://petstore.swagger.io/v2/pet/findByStatus/{id}":{method:"get",url:"http://petstore.swagger.io/v2/pet/findByStatus/{id}",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[{name:"status",value:"available"}],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{id:""},serverVariables:{},queryObj:{status:"available"},headersObj:{Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"status=available",query:{status:"available"},pathname:"/v2/pet/findByStatus/{id}",path:"/v2/pet/findByStatus/{id}?status=available",href:"http://petstore.swagger.io/v2/pet/findByStatus/%7Bid%7D"},fullUrl:"http://petstore.swagger.io/v2/pet/findByStatus/{id}?status=available"},"POST https://{customerId}.saas-app.com:{port}/v2":{method:"post",url:"https://{customerId}.saas-app.com:{port}/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:"text",params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],cvv_check:"string",status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[],pathParameters:{},serverVariables:{customerId:"demo",port:"443"},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"https:",slashes:!0,auth:null,host:"",port:null,hostname:"",hash:null,search:"",query:{},pathname:"{customerId}.saas-app.com:{port}/v2/pet",path:"{customerId}.saas-app.com:{port}/v2/pet",href:"https:///%7BcustomerId%7D.saas-app.com:%7Bport%7D/v2/pet"},fullUrl:"https://{customerId}.saas-app.com:{port}/v2/pet"},"POST http://petstore.swagger.io/login":{method:"post",url:"http://petstore.swagger.io/login",httpVersion:"HTTP/1.1",headers:[],queryString:[],postData:{mimeType:"application/json",text:"text",params:[],jsonObj:{}},basicAuth:{username:"usernamestring",password:"passwordstring"},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[],pathParameters:{},queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{},serverVariables:{},cookies:[{name:"cookieParam",value:"0"}],uriObj:{protocol:"https:",slashes:!0,auth:null,host:"",port:null,hostname:"",hash:null,search:"",query:{},pathname:"petstore.swagger.io/login",path:"petstore.swagger.io/login",href:"https://petstore.swagger.io/login"},fullUrl:"https://petstore.swagger.io/login"}};export const serverVariablesOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:Object.assign(Object.assign({},spec),{servers:[{url:"https://{customerId}.saas-app.com:{port}/v2",variables:{customerId:{default:"demo",description:"Customer ID assigned by the service provider"},port:{enum:["443","8443"],default:"443"}}}]})};
1
+ const spec={openapi:"3.0.0",servers:[{url:"//petstore.swagger.io/v2",description:"Default server"},{url:"//petstore.swagger.io/sandbox",description:"Sandbox server"}],info:{description:"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n# Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n# OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Subheader 1\n\nConsectetur adipiscing elit. Etiam fringilla tincidunt magna non dignissim. Vestibulum vestibulum ipsum augue, sed rhoncus diam consequat sodales. Sed facilisis maximus enim, ut scelerisque lorem ullamcorper eget. Suspendisse venenatis non lectus sed bibendum.\n*Duis neque ante, ultrices at ornare aliquam, vulputate ac dolor.*\n\n## Subheader 2\n\nLorem ipsum dolor sit amet. Ut tempor sem vitae dui varius, consequat varius ligula fringilla. Nulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vulputate pulvinar turpis, ac convallis quam.\n\n# Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n# Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n",version:"1.0.0",title:"Swagger Petstore",termsOfService:"http://swagger.io/terms/",contact:{name:"API Support",email:"apiteam@swagger.io",url:"https://github.com/Redocly/redoc"},"x-logo":{url:"https://redocly.github.io/redoc/petstore-logo.png",altText:"Petstore logo"},license:{name:"Apache 2.0",url:"http://www.apache.org/licenses/LICENSE-2.0.html"}},externalDocs:{description:"Find out how to create Github repo for your OpenAPI spec.",url:"https://github.com/Rebilly/generator-openapi-repo"},tags:[{name:"pet",description:"Lorem ipsum dolor sit amet.\n\n**Consectetur** adipiscing elit. Etiam fringilla tincidunt magna non dignissim. Vestibulum vestibulum ipsum augue, sed rhoncus diam consequat sodales. Sed facilisis maximus enim, ut scelerisque lorem ullamcorper eget. Suspendisse venenatis non lectus sed bibendum.\n*Duis neque ante, ultrices at ornare aliquam, vulputate ac dolor.*\n\nPellentesque nulla lorem:\n- dapibus lacinia magna vitae, \n- eleifend bibendum nisi\n\nNullam pretium erat ut augue mollis, id varius orci pretium. \n> Ut efficitur eget dui eget molestie.\n\nUt tempor sem vitae dui varius, consequat varius ligula fringilla. Nulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vulputate pulvinar turpis, ac convallis quam.\n[More info](http://swagger.io)\n"},{name:"store"},{name:"user",description:"Operations about user\n\n## Custom section 1\nNullam pretium erat ut augue mollis, id varius orci pretium. \n\n\n## Custom section 2\nNulla accumsan pellentesque lorem eu pharetra. Duis vel est metus. Nulla id quam eget ante egestas fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nSome Item\n"},{name:"pet_model","x-displayName":"The Pet Model",description:'<SchemaDefinition schemaRef="#/components/schemas/Pet" />\n'},{name:"store_model","x-displayName":"The Order Model",description:'<SchemaDefinition schemaRef="#/components/schemas/Order" exampleRef="#/components/examples/Order" showReadOnly={true} showWriteOnly={true} />\n'}],"x-tagGroups":[{name:"General",tags:["pet","store"]},{name:"User Management",tags:["user"]},{name:"Models",tags:["pet_model","store_model"]}],paths:{"/pet":{parameters:[{name:"Accept-Language",in:"header",description:"The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US",example:"en-US",required:!1,schema:{type:"string",default:"en-AU"}},{name:"cookieParam",in:"cookie",description:"Some cookie",required:!0,schema:{type:"integer",format:"int64"}}],post:{tags:["pet"],summary:"Add a new pet to the store",description:"Add new pet to the store inventory.",operationId:"addPet",responses:{405:{description:"Invalid input"}},security:[{petstore_auth:["write:pets","read:pets"]}],"x-codeSamples":[{lang:"C#",source:'PetStore.v1.Pet pet = new PetStore.v1.Pet();\npet.setApiKey("your api key");\npet.petType = PetStore.v1.Pet.TYPE_DOG;\npet.name = "Rex";\n// set other fields\nPetStoreResponse response = pet.create();\nif (response.statusCode == HttpStatusCode.Created)\n{\n // Successfully created\n}\nelse\n{\n // Something wrong -- check response for errors\n Console.WriteLine(response.getRawResponse());\n}\n'},{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->create($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}],requestBody:{$ref:"#/components/requestBodies/Pet"}},put:{tags:["pet"],summary:"Update an existing pet",description:"",operationId:"updatePet",responses:{400:{description:"Invalid ID supplied"},404:{description:"Pet not found"},405:{description:"Validation exception"}},security:[{petstore_auth:["write:pets","read:pets"]}],"x-codeSamples":[{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetId(1);\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->update($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}],requestBody:{$ref:"#/components/requestBodies/Pet"}}},"/pet/{petId}":{get:{tags:["pet"],summary:"Find pet by ID",description:"Returns a single pet",operationId:"getPetById",parameters:[{name:"petId",in:"path",description:"ID of pet to return",required:!0,deprecated:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Pet"}},"application/xml":{schema:{$ref:"#/components/schemas/Pet"}}}},400:{description:"Invalid ID supplied"},404:{description:"Pet not found"}},security:[{api_key:[]}]},post:{tags:["pet"],summary:"Updates a pet in the store with form data",description:"",operationId:"updatePetWithForm",parameters:[{name:"petId",in:"path",description:"ID of pet that needs to be updated",required:!0,schema:{type:"integer",format:"int64"}}],responses:{405:{description:"Invalid input"}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/x-www-form-urlencoded":{schema:{type:"object",properties:{name:{description:"Updated name of the pet",type:"string"},status:{description:"Updated status of the pet",type:"string"}}}}}}},delete:{tags:["pet"],summary:"Deletes a pet",description:"",operationId:"deletePet",parameters:[{name:"api_key",in:"header",required:!1,schema:{type:"string"},example:"Bearer <TOKEN>"},{name:"petId",in:"path",description:"Pet id to delete",required:!0,schema:{type:"integer",format:"int64"}}],responses:{400:{description:"Invalid pet value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{post:{tags:["pet"],summary:"uploads an image",description:"",operationId:"uploadFile",parameters:[{name:"petId",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/ApiResponse"}}}}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/octet-stream":{schema:{type:"string",format:"binary"}}}}}},"/pet/{petId}/uploadImage/{data}":{post:{tags:["pet"],summary:"uploads an image",description:"",operationId:"uploadFile",parameters:[{name:"petId",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}},{name:"data",in:"path",description:"ID of pet to update",required:!0,schema:{type:"integer",format:"int64"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/ApiResponse"}}}}},security:[{petstore_auth:["write:pets","read:pets"]}],requestBody:{content:{"application/octet-stream":{schema:{type:"string",format:"binary"}}}}}},"/pet/findByStatus":{get:{tags:["pet"],summary:"Finds Pets by status",description:"Multiple status values can be provided with comma separated strings",operationId:"findPetsByStatus",parameters:[{name:"status",in:"query",description:"Status values that need to be considered for filter",required:!0,style:"form",schema:{type:"array",minItems:1,maxItems:3,items:{type:"string",enum:["available","pending","sold"],default:"available"}}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}},"application/xml":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}}}},400:{description:"Invalid status value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/pet/findByTags":{get:{tags:["pet"],summary:"Finds Pets by tags",description:"Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",operationId:"findPetsByTags",deprecated:!0,parameters:[{name:"tags",in:"query",description:"Tags to filter by",required:!0,style:"form",schema:{type:"array",items:{type:"string"}}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}},"application/xml":{schema:{type:"array",items:{$ref:"#/components/schemas/Pet"}}}}},400:{description:"Invalid tag value"}},security:[{petstore_auth:["write:pets","read:pets"]}]}},"/store/inventory":{get:{tags:["store"],summary:"Returns pet inventories by status",description:"Returns a map of status codes to quantities",operationId:"getInventory",responses:{200:{description:"successful operation",content:{"application/json":{schema:{type:"object",additionalProperties:{type:"integer",format:"int32"}}}}}},security:[{api_key:[]}]}},"/store/order":{post:{tags:["store"],summary:"Place an order for a pet",description:"",operationId:"placeOrder",responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}},"application/xml":{schema:{$ref:"#/components/schemas/Order"}}}},400:{description:"Invalid Order",content:{"application/json":{example:{status:400,message:"Invalid Order"}}}}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}}},description:"order placed for purchasing the pet",required:!0}}},"/store/order/{orderId}":{get:{tags:["store"],summary:"Find purchase order by ID",description:"For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",operationId:"getOrderById",parameters:[{name:"orderId",in:"path",description:"ID of pet that needs to be fetched",required:!0,schema:{type:"integer",format:"int64",minimum:1,maximum:5}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/Order"}},"application/xml":{schema:{$ref:"#/components/schemas/Order"}}}},400:{description:"Invalid ID supplied"},404:{description:"Order not found"}}},delete:{tags:["store"],summary:"Delete purchase order by ID",description:"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",operationId:"deleteOrder",parameters:[{name:"orderId",in:"path",description:"ID of the order that needs to be deleted",required:!0,schema:{type:"string",minimum:1}}],responses:{400:{description:"Invalid ID supplied"},404:{description:"Order not found"}}}},"/store/subscribe":{post:{tags:["store"],summary:"Subscribe to the Store events",description:"Add subscription for a store events",requestBody:{content:{"application/json":{schema:{type:"object",properties:{callbackUrl:{type:"string",format:"uri",description:"This URL will be called by the server when the desired event will occur",example:"https://myserver.com/send/callback/here"},eventName:{type:"string",description:"Event name for the subscription",enum:["orderInProgress","orderShipped","orderDelivered"],example:"orderInProgress"}},required:["callbackUrl","eventName"]}}}},responses:{201:{description:"Subscription added",content:{"application/json":{schema:{type:"object",properties:{subscriptionId:{type:"string",example:"AAA-123-BBB-456"}}}}}}},callbacks:{orderInProgress:{"{$request.body#/callbackUrl}?event={$request.body#/eventName}":{servers:[{url:"//callback-url.path-level/v1",description:"Path level server 1"},{url:"//callback-url.path-level/v2",description:"Path level server 2"}],post:{summary:"Order in Progress (Summary)",description:'A callback triggered every time an Order is updated status to "inProgress" (Description)',externalDocs:{description:"Find out more",url:"https://more-details.com/demo"},requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},status:{type:"string",example:"inProgress"}}}},"application/xml":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"}}},example:'<?xml version="1.0" encoding="UTF-8"?>\n<root>\n <orderId>123</orderId>\n <status>inProgress</status>\n <timestamp>2018-10-19T16:46:45Z</timestamp>\n</root>\n'}}},responses:{200:{description:"Callback successfully processed and no retries will be performed",content:{"application/json":{schema:{type:"object",properties:{someProp:{type:"string",example:"123"}}}}}},299:{description:"Response for cancelling subscription"},500:{description:"Callback processing failed and retries will be performed"}},"x-codeSamples":[{lang:"C#",source:'PetStore.v1.Pet pet = new PetStore.v1.Pet();\npet.setApiKey("your api key");\npet.petType = PetStore.v1.Pet.TYPE_DOG;\npet.name = "Rex";\n// set other fields\nPetStoreResponse response = pet.create();\nif (response.statusCode == HttpStatusCode.Created)\n{\n // Successfully created\n}\nelse\n{\n // Something wrong -- check response for errors\n Console.WriteLine(response.getRawResponse());\n}\n'},{lang:"PHP",source:'$form = new \\PetStore\\Entities\\Pet();\n$form->setPetType("Dog");\n$form->setName("Rex");\n// set other fields\ntry {\n $pet = $client->pets()->create($form);\n} catch (UnprocessableEntityException $e) {\n var_dump($e->getErrors());\n}\n'}]},put:{description:"Order in Progress (Only Description)",servers:[{url:"//callback-url.operation-level/v1",description:"Operation level server 1 (Operation override)"},{url:"//callback-url.operation-level/v2",description:"Operation level server 2 (Operation override)"}],requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},status:{type:"string",example:"inProgress"}}}},"application/xml":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"}}},example:'<?xml version="1.0" encoding="UTF-8"?>\n<root>\n <orderId>123</orderId>\n <status>inProgress</status>\n <timestamp>2018-10-19T16:46:45Z</timestamp>\n</root>\n'}}},responses:{200:{description:"Callback successfully processed and no retries will be performed",content:{"application/json":{schema:{type:"object",properties:{someProp:{type:"string",example:"123"}}}}}}}}}},orderShipped:{"{$request.body#/callbackUrl}?event={$request.body#/eventName}":{post:{description:"Very long description\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu\nfugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in\nculpa qui officia deserunt mollit anim id est laborum.\n",requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"},estimatedDeliveryDate:{type:"string",format:"date-time",example:"2018-11-11T16:00:00Z"}}}}}},responses:{200:{description:"Callback successfully processed and no retries will be performed"}}}}},orderDelivered:{"http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}":{post:{deprecated:!0,summary:"Order delivered",description:"A callback triggered every time an Order is delivered to the recipient",requestBody:{content:{"application/json":{schema:{type:"object",properties:{orderId:{type:"string",example:"123"},timestamp:{type:"string",format:"date-time",example:"2018-10-19T16:46:45Z"}}}}}},responses:{200:{description:"Callback successfully processed and no retries will be performed"}}}}}}}},"/user":{post:{tags:["user"],summary:"Create user",description:"This can only be done by the logged in user.",operationId:"createUser",responses:{default:{description:"successful operation"}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/User"}}},description:"Created user object",required:!0}}},"/user/{username}":{get:{tags:["user"],summary:"Get user by user name",description:"",operationId:"getUserByName",parameters:[{name:"username",in:"path",description:"The name that needs to be fetched. Use user1 for testing. ",required:!0,schema:{type:"string"}}],responses:{200:{description:"successful operation",content:{"application/json":{schema:{$ref:"#/components/schemas/User"}},"application/xml":{schema:{$ref:"#/components/schemas/User"}}}},400:{description:"Invalid username supplied"},404:{description:"User not found"}}},put:{tags:["user"],summary:"Updated user",description:"This can only be done by the logged in user.",operationId:"updateUser",parameters:[{name:"username",in:"path",description:"name that need to be deleted",required:!0,schema:{type:"string"}}],responses:{400:{description:"Invalid user supplied"},404:{description:"User not found"}},requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/User"}}},description:"Updated user object",required:!0}},delete:{tags:["user"],summary:"Delete user",description:"This can only be done by the logged in user.",operationId:"deleteUser",parameters:[{name:"username",in:"path",description:"The name that needs to be deleted",required:!0,schema:{type:"string"}}],responses:{400:{description:"Invalid username supplied"},404:{description:"User not found"}}}},"/user/createWithArray":{post:{tags:["user"],summary:"Creates list of users with given input array",description:"",operationId:"createUsersWithArrayInput",responses:{default:{description:"successful operation"}},requestBody:{$ref:"#/components/requestBodies/UserArray"}}},"/user/createWithList":{post:{tags:["user"],summary:"Creates list of users with given input array",description:"",operationId:"createUsersWithListInput",responses:{default:{description:"successful operation"}},requestBody:{$ref:"#/components/requestBodies/UserArray"}}},"/user/login":{get:{tags:["user"],summary:"Logs user into the system",description:"",operationId:"loginUser",parameters:[{name:"username",in:"query",description:"The user name for login",required:!0,schema:{type:"string"}},{name:"password",in:"query",description:"The password for login in clear text",required:!0,schema:{type:"string"}}],responses:{200:{description:"successful operation",headers:{"X-Rate-Limit":{description:"calls per hour allowed by the user",schema:{type:"integer",format:"int32"}},"X-Expires-After":{description:"date in UTC when token expires",schema:{type:"string",format:"date-time"}}},content:{"application/json":{schema:{type:"string"},examples:{response:{value:"OK"}}},"application/xml":{schema:{type:"string"},examples:{response:{value:"<Message> OK </Message>"}}},"text/plain":{examples:{response:{value:"OK"}}}}},400:{description:"Invalid username/password supplied"}}}},"/user/logout":{get:{tags:["user"],summary:"Logs out current logged in user session",description:"",operationId:"logoutUser",responses:{default:{description:"successful operation"}}}}},components:{schemas:{ApiResponse:{type:"object",properties:{code:{type:"integer",format:"int32"},type:{type:"string"},message:{type:"string"}}},Cat:{description:"A representation of a cat",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{huntingSkill:{type:"string",description:"The measured skill for hunting",default:"lazy",example:"adventurous",enum:["clueless","lazy","adventurous","aggressive"]}},required:["huntingSkill"]}]},Category:{type:"object",properties:{id:{description:"Category ID",allOf:[{$ref:"#/components/schemas/Id"}]},name:{description:"Category name",type:"string",minLength:1},sub:{description:"Test Sub Category",type:"object",properties:{prop1:{type:"string",description:"Dumb Property"}}}},xml:{name:"Category"}},Dog:{description:"A representation of a dog",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{packSize:{type:"integer",format:"int32",description:"The size of the pack the dog is from",default:1,minimum:1}},required:["packSize"]}]},HoneyBee:{description:"A representation of a honey bee",allOf:[{$ref:"#/components/schemas/Pet"},{type:"object",properties:{honeyPerDay:{type:"number",description:"Average amount of honey produced per day in ounces",example:3.14,multipleOf:.01}},required:["honeyPerDay"]}]},Id:{type:"integer",format:"int64",readOnly:!0},Order:{type:"object",properties:{id:{description:"Order ID",allOf:[{$ref:"#/components/schemas/Id"}]},petId:{description:"Pet ID",allOf:[{$ref:"#/components/schemas/Id"}]},quantity:{type:"integer",format:"int32",minimum:1,default:1},shipDate:{description:"Estimated ship date",type:"string",format:"date-time"},status:{type:"string",description:"Order Status",enum:["placed","approved","delivered"]},complete:{description:"Indicates whenever order was completed or not",type:"boolean",default:!1,readOnly:!0},requestId:{description:"Unique Request Id",type:"string",writeOnly:!0}},xml:{name:"Order"}},Pet:{type:"object",required:["name","photoUrls"],discriminator:{propertyName:"petType",mapping:{cat:"#/components/schemas/Cat",dog:"#/components/schemas/Dog",bee:"#/components/schemas/HoneyBee"}},properties:{id:{externalDocs:{description:"Find more info here",url:"https://example.com"},description:"Pet ID",allOf:[{$ref:"#/components/schemas/Id"}]},category:{description:"Categories this pet belongs to",allOf:[{$ref:"#/components/schemas/Category"}]},name:{description:"The name given to a pet",type:"string",example:"Guru"},photoUrls:{description:"The list of URL to a cute photos featuring pet",type:"array",maxItems:20,xml:{name:"photoUrl",wrapped:!0},items:{type:"string",format:"url"}},friend:{allOf:[{$ref:"#/components/schemas/Pet"}]},tags:{description:"Tags attached to the pet",type:"array",minItems:1,xml:{name:"tag",wrapped:!0},items:{$ref:"#/components/schemas/Tag"}},status:{type:"string",description:"Pet status in the store",enum:["available","pending","sold"]},petType:{description:"Type of a pet",type:"string"}},xml:{name:"Pet"}},Tag:{type:"object",properties:{id:{description:"Tag ID",allOf:[{$ref:"#/components/schemas/Id"}]},name:{description:"Tag name",type:"string",minLength:1}},xml:{name:"Tag"}},User:{type:"object",properties:{id:{$ref:"#/components/schemas/Id"},pet:{oneOf:[{$ref:"#/components/schemas/Pet"},{$ref:"#/components/schemas/Tag"}]},username:{description:"User supplied username",type:"string",minLength:4,example:"John78"},firstName:{description:"User first name",type:"string",minLength:1,example:"John"},lastName:{description:"User last name",type:"string",minLength:1,example:"Smith"},email:{description:"User email address",type:"string",format:"email",example:"john.smith@example.com"},password:{type:"string",description:"User password, MUST contain a mix of upper and lower case letters, as well as digits",format:"password",minLength:8,pattern:"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/",example:"drowssaP123"},phone:{description:"User phone number in international format",type:"string",pattern:"/^\\+(?:[0-9]-?){6,14}[0-9]$/",example:"+1-202-555-0192"},userStatus:{description:"User status",type:"integer",format:"int32"}},xml:{name:"User"}}},requestBodies:{Pet:{content:{"application/json":{schema:{allOf:[{description:"My Pet",title:"Pettie"},{$ref:"#/components/schemas/Pet"}]}},"application/xml":{schema:{type:"object",properties:{name:{type:"string",description:"hooray"}}}}},description:"Pet object that needs to be added to the store",required:!0},UserArray:{content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/User"}}}},description:"List of user object",required:!0}},securitySchemes:{petstore_auth:{description:"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n",type:"oauth2",flows:{clientCredentials:{tokenUrl:"http://petstore.swagger.io/api/oauth/dialog",scopes:{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},api_key:{description:"For this sample, you can use the api key `special-key` to test the authorization filters.\n",type:"apiKey",name:"api_key",in:"header"}},examples:{Order:{value:{quantity:1,shipDate:"2018-10-19T16:46:45Z",status:"placed",complete:!1}}}},"x-webhooks":{newPet:{post:{summary:"New pet",description:"Information about a new pet in the systems",operationId:"newPet",tags:["pet"],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Pet"}}}},responses:{200:{description:"Return a 200 status to indicate that the data was received successfully"}}}}}};export const originalOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:spec};export const source={"POST http://petstore.swagger.io/v2/pet":{method:"post",url:"http://petstore.swagger.io/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:'{"category":{"name":"string","sub":{"prop1":"string"}},"name":"Guru","photoUrls":["string"],"friend":{},"tags":[{"name":"string"}],"status":"available","petType":"cat","huntingSkill":"adventurous"}',params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet",path:"/v2/pet",href:"http://petstore.swagger.io/v2/pet"},fullUrl:"http://petstore.swagger.io/v2/pet"},"POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}":{method:"post",url:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Content-Type",value:"application/octet-stream"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{petId:"",data:""},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet/{petId}/uploadImage/{data}",path:"/v2/pet/{petId}/uploadImage/{data}",href:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}"},fullUrl:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}"},"PUT http://petstore.swagger.io/v2/pet":{method:"put",url:"http://petstore.swagger.io/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:'{"category":{"name":"string","sub":{"prop1":"string"}},"name":"Guru","photoUrls":["string"],"friend":{},"tags":[{"name":"string"}],"status":"available","petType":"cat","huntingSkill":"adventurous"}',params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet",path:"/v2/pet",href:"http://petstore.swagger.io/v2/pet"},fullUrl:"http://petstore.swagger.io/v2/pet"},"POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage":{method:"post",url:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Content-Type",value:"application/octet-stream"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{petId:""},serverVariables:{},queryObj:{},headersObj:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{"Content-Type":"application/octet-stream",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"",query:{},pathname:"/v2/pet/{petId}/uploadImage",path:"/v2/pet/{petId}/uploadImage",href:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage"},fullUrl:"http://petstore.swagger.io/v2/pet/{petId}/uploadImage"},"GET http://petstore.swagger.io/v2/pet/findByStatus/{id}":{method:"get",url:"http://petstore.swagger.io/v2/pet/findByStatus/{id}",httpVersion:"HTTP/1.1",cookies:[],headers:[{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[{name:"status",value:"available"}],headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[{method:"POST",url:"http://petstore.swagger.io/api/oauth/dialog",httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:"YOUR_CLIENT_ID"},{name:"client_secret",value:"YOUR_CLIENT_SECRET"},{name:"scope",value:"write:pets read:pets"}]},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}],pathParameters:{id:""},serverVariables:{},queryObj:{status:"available"},headersObj:{Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{},allHeaders:{Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"http:",slashes:!0,auth:null,host:"petstore.swagger.io",port:null,hostname:"petstore.swagger.io",hash:null,search:"status=available",query:{status:"available"},pathname:"/v2/pet/findByStatus/{id}",path:"/v2/pet/findByStatus/{id}?status=available",href:"http://petstore.swagger.io/v2/pet/findByStatus/%7Bid%7D"},fullUrl:"http://petstore.swagger.io/v2/pet/findByStatus/{id}?status=available"},"POST https://{customerId}.saas-app.com:{port}/v2":{method:"post",url:"https://{customerId}.saas-app.com:{port}/v2/pet",httpVersion:"HTTP/1.1",cookies:[{name:"cookieParam",value:"0"}],headers:[{name:"Content-Type",value:"application/json"},{name:"Accept-Language",value:"en-AU"},{name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"}],queryString:[],postData:{mimeType:"application/json",text:"text",params:[],jsonObj:{category:{name:"string",sub:{prop1:"string"}},name:"Guru",photoUrls:["string"],friend:{},tags:[{name:"string"}],cvv_check:"string",status:"available",petType:"cat",huntingSkill:"adventurous"}},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[],pathParameters:{},serverVariables:{customerId:"demo",port:"443"},queryObj:{},headersObj:{"Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},cookiesObj:{cookieParam:"0"},allHeaders:{cookie:"cookieParam=0","Content-Type":"application/json","Accept-Language":"en-AU",Authorization:"Bearer <YOUR_TOKEN_HERE>"},uriObj:{protocol:"https:",slashes:!0,auth:null,host:"",port:null,hostname:"",hash:null,search:"",query:{},pathname:"{customerId}.saas-app.com:{port}/v2/pet",path:"{customerId}.saas-app.com:{port}/v2/pet",href:"https:///%7BcustomerId%7D.saas-app.com:%7Bport%7D/v2/pet"},fullUrl:"https://{customerId}.saas-app.com:{port}/v2/pet"},"POST http://petstore.swagger.io/login":{method:"post",url:"http://petstore.swagger.io/login",httpVersion:"HTTP/1.1",headers:[],queryString:[],postData:{mimeType:"application/json",text:"text",params:[],jsonObj:{}},basicAuth:{username:"usernamestring",password:"passwordstring"},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[],pathParameters:{},queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{},serverVariables:{},cookies:[{name:"cookieParam",value:"0"}],uriObj:{protocol:"https:",slashes:!0,auth:null,host:"",port:null,hostname:"",hash:null,search:"",query:{},pathname:"petstore.swagger.io/login",path:"petstore.swagger.io/login",href:"https://petstore.swagger.io/login"},fullUrl:"https://petstore.swagger.io/login"},"POST http://petstore.swagger.io/v2/uploadImage":{httpVersion:"HTTP/1.1",queryString:[],basicAuth:{username:"usernamestring",password:"passwordstring"},headersSize:0,bodySize:0,securityOAuth2ExtraCalls:[],pathParameters:{},queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{},serverVariables:{},cookies:[{name:"cookieParam",value:"0"}],uriObj:{protocol:"https:",slashes:!0,auth:null,host:"",port:null,hostname:"",hash:null,search:"",query:{},pathname:"petstore.swagger.io/login",path:"petstore.swagger.io/login",href:"https://petstore.swagger.io/login"},fullUrl:"https://petstore.swagger.io/login",method:"POST",url:"http://petstore.swagger.io/v2/uploadImage",headers:[],postData:{mimeType:"multipart/form-data",params:[{name:"file",value:"pet_image.png"},{name:"description",value:"Pet photo"}]}}};export const serverVariablesOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:Object.assign(Object.assign({},spec),{servers:[{url:"https://{customerId}.saas-app.com:{port}/v2",variables:{customerId:{default:"demo",description:"Customer ID assigned by the service provider"},port:{enum:["443","8443"],default:"443"}}}]})};
2
2
  //# sourceMappingURL=mock.js.map
@@ -1,2 +1,2 @@
1
- import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const hasQueryParams=e=>!(!e.uriObj.query||!Object.keys(e.uriObj.query).length),getBody=e=>e.postData&&e.postData.mimeType===MediaTypes.URL_ENCODED?"HttpRequest.BodyPublishers.ofString(form)":e.postData?"HttpRequest.BodyPublishers.ofString(payload)":["POST","PUT","PATCH"].includes(e.method.toUpperCase())?'HttpRequest.BodyPublishers.ofString("some body text")':"",handler=function(e,t,{target:a,client:s}){var r,n,o;const i=Object.assign({indent:" ",withWrapper:!0},t),p=new CodeBuilder({indentation:i.indent,variablesPrefix:i.variablesPrefix,capitalize:!0,lang:Lang.JAVA});let l=!1;if(i.withComments&&addComments(p,e),i.withImports&&addImports(p,e),i.withWrapper&&(p.push("public class App {"),p.push(1,"public static void main(String[] args) throws Exception {"),p.push(2,"var httpClient = HttpClient.newBuilder().build();"),p.blank()),null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){const t=new HTTPSnippet(null===(n=e.securityOAuth2ExtraCalls)||void 0===n?void 0:n[0]).convert(a,s,Object.assign(Object.assign({},i),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));p.push(t),p.blank(),p.push(2,"var oauth2Response = httpClient.send(oauth2Request, HttpResponse.BodyHandlers.ofString());"),p.push(2,'var accessToken = new JSONObject(oauth2Response.body()).getString("access_token");'),p.blank()}if(e.postData)switch(normalizeMimeType(e.postData.mimeType)){case MediaTypes.URL_ENCODED:e.postData.params&&(p.push(2,"HashMap<String, String> params = new HashMap<>();"),e.postData.params.forEach((e=>{p.push(2,'params.put("%s", "%s");',e.name,e.value)})),p.blank(),p.push(2,"var form = params.keySet().stream()"),p.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),p.push(3,'.collect(Collectors.joining("&"));'),p.blank());break;case MediaTypes.JSON:e.postData.jsonObj&&(p.push(2,`var payload = String.join("\\n"\n ${addIndentation(JSON.stringify(e.postData.jsonObj,null,1).replace(/"/g,'\\"').replace(/^/gm,', "').replace(/$/gm,'"'),{level:3,indent:i.indent,firstLine:!1})}`),p.push(2,");"),p.blank());break;case MediaTypes.XML:e.postData.text&&(p.push(2,'var payload = String.join("\\n"'),e.postData.text.trim().split("\n").forEach((e=>{const t=e.replace(/"/g,'\\"');p.push(3,`"${t}", `)})),p.push(2,");"),p.blank());break;case MediaTypes.MULTIPART:l=!0,p.unshift("# multipart/form-data is not supported yet\n")}if(hasQueryParams(e)){p.push(2,"HashMap<String, String> params = new HashMap<>();");for(const[t,a]of Object.entries(e.uriObj.query))p.push(2,'params.put("%s", "%s");',t,a);p.blank(),p.push(2,"var query = params.keySet().stream()"),p.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),p.push(3,'.collect(Collectors.joining("&"));'),p.blank()}p.push(2,`var ${p.var("host")} = "%s";`,e.uriObj.protocol+"//"+e.uriObj.host),printUrlVariablesDeclarations(e,p,2);const u=Object.assign(Object.assign({},e),{pathname:e.uriObj.pathname});p.push(2,`var ${p.var("pathname")} = %s;`,buildUrlExpression(u,p)),p.push(2,`var ${p.var("request")} = HttpRequest.newBuilder()`),"PATCH"===e.method.toUpperCase()?p.push(3,'.method("PATCH", %s)',getBody(e)):p.push(3,".%s(%s)",e.method.toUpperCase(),getBody(e)),p.push(3,`.uri(URI.create(${p.var("host")} + ${p.var("pathname")} %s))`,hasQueryParams(e)?"+ '?' + query":""),(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length)&&(e.allHeaders.Authorization='"Bearer " + accessToken');const h=Object.keys(e.allHeaders);if(h.length&&h.forEach((t=>{var a;p.push(3,'.header("%s", %s)',t,"Authorization"===t&&(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?e.allHeaders[t]:`"${e.allHeaders[t]}"`)})),e.basicAuth){const{username:t,password:a}=e.basicAuth;p.push(3,`.header("Authorization", "Basic " + Base64.getEncoder().encodeToString(("${t}:${a}").getBytes()))`)}return p.push(3,".build();"),i.withWrapper&&(p.blank(),p.push(2,"var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());"),p.blank(),p.push(2,"System.out.println(response.body());"),p.push(1,"}"),p.push("}")),l&&p.clean(),p.join()};export const info={key:"httpclient",title:"HttpClient",link:"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html",description:"HttpClient (Java SE 11 & JDK 11 )"};export default handler;function addComments(e,t){var a;e.push("/**"),e.push(" * Requires JDK >= 11"),(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&(e.push(" *"),e.push(' * Requires package "org.json" >= 20201115'),e.push(" * See here for installation details:"),e.push(" * https://search.maven.org/artifact/org.json/json")),e.push(" */"),e.blank()}function addImports(e,t){var a,s,r,n;e.push("import java.net.*;"),e.push("import java.net.http.*;"),e.push("import java.util.*;"),(normalizeMimeType(null===(a=t.postData)||void 0===a?void 0:a.mimeType)===MediaTypes.URL_ENCODED&&(null===(s=t.postData)||void 0===s?void 0:s.params)||(null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length)||hasQueryParams(t))&&(e.push("import java.nio.charset.StandardCharsets;"),e.push("import java.util.stream.Collectors;")),(null===(n=t.securityOAuth2ExtraCalls)||void 0===n?void 0:n.length)&&e.push("import org.json.JSONObject;"),e.blank()}
1
+ import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const hasQueryParams=t=>!(!t.uriObj.query||!Object.keys(t.uriObj.query).length),getBody=t=>t.postData&&t.postData.mimeType===MediaTypes.URL_ENCODED?"HttpRequest.BodyPublishers.ofString(form)":t.postData?"HttpRequest.BodyPublishers.ofString(payload)":["POST","PUT","PATCH"].includes(t.method.toUpperCase())?'HttpRequest.BodyPublishers.ofString("some body text")':"",handler=function(t,e,{target:a,client:s}){var r,o,p;const i=Object.assign({indent:" ",withWrapper:!0},e),n=new CodeBuilder({indentation:i.indent,variablesPrefix:i.variablesPrefix,capitalize:!0,lang:Lang.JAVA});if(i.withComments&&addComments(n,t),i.withImports&&addImports(n,t),i.withWrapper&&(n.push("public class App {"),n.push(1,"public static void main(String[] args) throws Exception {"),n.push(2,"var httpClient = HttpClient.newBuilder().build();"),n.blank()),null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){const e=new HTTPSnippet(null===(o=t.securityOAuth2ExtraCalls)||void 0===o?void 0:o[0]).convert(a,s,Object.assign(Object.assign({},i),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));n.push(e),n.blank(),n.push(2,"var oauth2Response = httpClient.send(oauth2Request, HttpResponse.BodyHandlers.ofString());"),n.push(2,'var accessToken = new JSONObject(oauth2Response.body()).getString("access_token");'),n.blank()}if(t.postData)switch(normalizeMimeType(t.postData.mimeType)){case MediaTypes.URL_ENCODED:t.postData.params&&(n.push(2,"HashMap<String, String> params = new HashMap<>();"),t.postData.params.forEach((t=>{n.push(2,'params.put("%s", "%s");',t.name,t.value)})),n.blank(),n.push(2,"var form = params.keySet().stream()"),n.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),n.push(3,'.collect(Collectors.joining("&"));'),n.blank());break;case MediaTypes.JSON:t.postData.jsonObj&&(n.push(2,`var payload = String.join("\\n"\n ${addIndentation(JSON.stringify(t.postData.jsonObj,null,1).replace(/"/g,'\\"').replace(/^/gm,', "').replace(/$/gm,'"'),{level:3,indent:i.indent,firstLine:!1})}`),n.push(2,");"),n.blank());break;case MediaTypes.XML:t.postData.text&&(n.push(2,'var payload = String.join("\\n"'),t.postData.text.trim().split("\n").forEach((t=>{const e=t.replace(/"/g,'\\"');n.push(3,`"${e}", `)})),n.push(2,");"),n.blank());break;case MediaTypes.MULTIPART:t.postData.params&&(n.push(2,"var multipartBody = MultipartBodyPublisher.newBuilder();"),t.postData.params&&t.postData.params.forEach((t=>{n.push(2,'multipartBody.append("%s", "%s");',t.name,t.value)})),n.push(2,"var body = multipartBody.build();"),n.blank())}if(hasQueryParams(t)){n.push(2,"HashMap<String, String> params = new HashMap<>();");for(const[e,a]of Object.entries(t.uriObj.query))n.push(2,'params.put("%s", "%s");',e,a);n.blank(),n.push(2,"var query = params.keySet().stream()"),n.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),n.push(3,'.collect(Collectors.joining("&"));'),n.blank()}n.push(2,`var ${n.var("host")} = "%s";`,t.uriObj.protocol+"//"+t.uriObj.host),printUrlVariablesDeclarations(t,n,2);const l=Object.assign(Object.assign({},t),{pathname:t.uriObj.pathname});n.push(2,`var ${n.var("pathname")} = %s;`,buildUrlExpression(l,n)),n.push(2,`var ${n.var("request")} = HttpRequest.newBuilder()`),"PATCH"===t.method.toUpperCase()?n.push(3,'.method("PATCH", %s)',getBody(t)):n.push(3,".%s(%s)",t.method.toUpperCase(),getBody(t)),n.push(3,`.uri(URI.create(${n.var("host")} + ${n.var("pathname")} %s))`,hasQueryParams(t)?"+ '?' + query":""),(null===(p=t.securityOAuth2ExtraCalls)||void 0===p?void 0:p.length)&&(t.allHeaders.Authorization='"Bearer " + accessToken');const u=Object.keys(t.allHeaders);if(u.length&&u.forEach((e=>{var a;n.push(3,'.header("%s", %s)',e,"Authorization"===e&&(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?t.allHeaders[e]:`"${t.allHeaders[e]}"`)})),t.basicAuth){const{username:e,password:a}=t.basicAuth;n.push(3,`.header("Authorization", "Basic " + Base64.getEncoder().encodeToString(("${e}:${a}").getBytes()))`)}return n.push(3,".build();"),i.withWrapper&&(n.blank(),n.push(2,"var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());"),n.blank(),n.push(2,"System.out.println(response.body());"),n.push(1,"}"),n.push("}")),n.join()};export const info={key:"httpclient",title:"HttpClient",link:"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html",description:"HttpClient (Java SE 11 & JDK 11 )"};export default handler;function addComments(t,e){var a;t.push("/**"),t.push(" * Requires JDK >= 11"),(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&(t.push(" *"),t.push(' * Requires package "org.json" >= 20201115'),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.json/json")),t.push(" */"),t.blank()}function addImports(t,e){var a,s,r,o;t.push("import java.net.*;"),t.push("import java.net.http.*;"),t.push("import java.util.*;"),(normalizeMimeType(null===(a=e.postData)||void 0===a?void 0:a.mimeType)===MediaTypes.URL_ENCODED&&(null===(s=e.postData)||void 0===s?void 0:s.params)||(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length)||hasQueryParams(e))&&(t.push("import java.nio.charset.StandardCharsets;"),t.push("import java.util.stream.Collectors;")),(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length)&&t.push("import org.json.JSONObject;"),t.blank()}
2
2
  //# sourceMappingURL=httpclient.js.map
@@ -1,2 +1,2 @@
1
- import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const handler=function(e,t,{target:s,client:a}){var o,r,n,i;const l=Object.assign({indent:" "},t),{level:p=0}=l,u=new CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:Lang.PYTHON});l.withComments&&addComments(u),l.withImports&&u.push("import requests").blank();let d,h,c=!1,m=e.allHeaders;if(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length){const t=new HTTPSnippet(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));u.push(t),u.blank(),m=m||{},m.Authorization='"Bearer " + oauth2_data["access_token"]',c=!0}if(printUrlVariablesDeclarations(e,u),u.push(`${u.var("url").toLowerCase()} = %s`,buildUrlExpression(e,u)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),u.push(d).blank()}const b=normalizeMimeType(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(b){case MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${addIndentation(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case MediaTypes.JSON:e.postData.jsonObj&&(h=addIndentation(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case MediaTypes.MULTIPART:u.unshift("# multipart/form-data is not supported yet\n");break;default:e.postData.text&&(h=`'''\n${addIndentation(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let f;h&&u.push(`${u.var("payload").toLowerCase()} = %s`,h).blank();const v=Object.keys(m).length,C=(e,t)=>"Authorization"===e&&c?t:`"${t}"`;if(1===v)for(f in m)u.push(`${u.var("headers").toLowerCase()} = {"${f}": ${C(f,m[f])}}`).blank();else if(v>1){let e=1;for(f in u.push(`${u.var("headers").toLowerCase()} = {`),m)e++!==v?u.push(1,`"${f}": ${C(f,m[f])},`):u.push(1,`"${f}": ${C(f,m[f])}`);u.push(0,"}").blank()}const $=e.method.toLowerCase();let L=format(`${u.var("response").toLowerCase()} = requests.${$}(${u.var("url").toLowerCase()}`);if(h){L+=`, ${b===MediaTypes.JSON?"json":"data"}=${u.var("payload").toLowerCase()}`}return v>0&&(L+=`, headers=${u.var("headers").toLowerCase()}`),d&&(L+=`, params=${u.var("query").toLowerCase()}`),e.basicAuth&&(L+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),L+=")",u.push(L).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?u.push("if response.status_code == 204:").push(p+1,'print("success")').push("else:").push(p+1,`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(p+1,`print(${u.var("data").toLowerCase()})`):u.push(`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(`print(${u.var("data").toLowerCase()})`),u.join()};export default handler;function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}
1
+ import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const handler=function(e,t,{target:a,client:s}){var o,r,n,i;const l=Object.assign({indent:" "},t),{level:p=0}=l,u=new CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:Lang.PYTHON});l.withComments&&addComments(u),l.withImports&&u.push("import requests").blank();let d,h,c,m=!1,b=e.allHeaders;if(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length){const t=new HTTPSnippet(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(a,s,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));u.push(t),u.blank(),b=b||{},b.Authorization='"Bearer " + oauth2_data["access_token"]',m=!0}if(printUrlVariablesDeclarations(e,u),u.push(`${u.var("url").toLowerCase()} = %s`,buildUrlExpression(e,u)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),u.push(d).blank()}const f=normalizeMimeType(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(f){case MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${addIndentation(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case MediaTypes.JSON:e.postData.jsonObj&&(h=addIndentation(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case MediaTypes.MULTIPART:const t=[];if(e.postData.params)for(const a of e.postData.params)t.push(`"${a.name}": "${a.value}"`);if(t.length){c=`data = {\n${t.map((e=>` ${e}`)).join(",\n")}\n}`}c&&u.push(c).blank();break;default:e.postData.text&&(h=`'''\n${addIndentation(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let v;h&&u.push(`${u.var("payload").toLowerCase()} = %s`,h).blank();const $=Object.keys(b).length,C=(e,t)=>"Authorization"===e&&m?t:`"${t}"`;if(1===$)for(v in b)u.push(`${u.var("headers").toLowerCase()} = {"${v}": ${C(v,b[v])}}`).blank();else if($>1){let e=1;for(v in u.push(`${u.var("headers").toLowerCase()} = {`),b)e++!==$?u.push(1,`"${v}": ${C(v,b[v])},`):u.push(1,`"${v}": ${C(v,b[v])}`);u.push(0,"}").blank()}const L=e.method.toLowerCase();let j=format(`${u.var("response").toLowerCase()} = requests.${L}(${u.var("url").toLowerCase()}`);if(f===MediaTypes.MULTIPART&&c&&(j+=", data=data"),h){j+=`, ${f===MediaTypes.JSON?"json":"data"}=${u.var("payload").toLowerCase()}`}return $>0&&(j+=`, headers=${u.var("headers").toLowerCase()}`),d&&(j+=`, params=${u.var("query").toLowerCase()}`),e.basicAuth&&(j+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),j+=")",u.push(j).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?u.push("if response.status_code == 204:").push(p+1,'print("success")').push("else:").push(p+1,`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(p+1,`print(${u.var("data").toLowerCase()})`):u.push(`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(`print(${u.var("data").toLowerCase()})`),u.join()};export default handler;function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}
2
2
  //# sourceMappingURL=requests.js.map
@@ -1,2 +1,2 @@
1
- import{encodeBackSlashes,getOperationId,getOperationName}from"../../utils";export function getOperationsItems(e,t,o){if(0===t.operations.length)return[];const r=[],a=[];for(const p of t.operations){const t=getOperationId(p,e),n={id:t,type:"operation",parent:e,operationDefinition:p,depth:o,name:getOperationName(p),httpVerb:p.httpVerb,path:p.pathName,items:[],isWebhook:p.isWebhook,operationId:p.operationId,badges:p["x-badges"]||[],href:getHref({id:t}),deprecated:!!p.deprecated};p.isWebhook?a.push(n):r.push(n)}return[...r.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated))),...a.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated)))]}export function getHref({id:e}){return encodeBackSlashes(`/${e}`.toLowerCase())}
1
+ import{REDOCLY_TEAMS_RBAC}from"@redocly/config";import{encodeBackSlashes,getOperationId,getOperationName}from"../../utils";export function getOperationsItems(e,t,o){if(0===t.operations.length)return[];const r=[],a=[];for(const n of t.operations){const t=getOperationId(n,e),p={id:t,type:"operation",parent:e,operationDefinition:n,depth:o,name:getOperationName(n),httpVerb:n.httpVerb,path:n.pathName,items:[],isWebhook:n.isWebhook,operationId:n.operationId,badges:n["x-badges"]||[],href:getHref({id:t}),deprecated:!!n.deprecated,[REDOCLY_TEAMS_RBAC]:n[REDOCLY_TEAMS_RBAC]||(null==e?void 0:e[REDOCLY_TEAMS_RBAC])};n.isWebhook?a.push(p):r.push(p)}return[...r.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated))),...a.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated)))]}export function getHref({id:e}){return encodeBackSlashes(`/${e}`.toLowerCase())}
2
2
  //# sourceMappingURL=operation.js.map
@@ -1,3 +1,4 @@
1
+ import type { REDOCLY_TEAMS_RBAC } from '@redocly/config';
1
2
  import type { ReactElement } from 'react';
2
3
  import type { Node } from '@markdoc/markdoc';
3
4
  import type { OpenAPIDefinition, OpenAPIInfo, OpenAPIOperation, OpenAPIParameter, OpenAPISchema, OpenAPIServer, OpenAPITag, Referenced } from '../types';
@@ -34,6 +35,7 @@ export interface IMenuItem {
34
35
  isWebhook?: boolean;
35
36
  path?: string;
36
37
  definition?: OpenAPIDefinition;
38
+ [REDOCLY_TEAMS_RBAC]?: Record<string, string>;
37
39
  }
38
40
  export type TagInfo = OpenAPITag & {
39
41
  operations: ExtendedOpenAPIOperation[];