@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.
- package/dist/redocly-openapi-docs.min.js +653 -645
- package/lib/models/field.js +1 -1
- package/lib/models/group.js +1 -1
- package/lib/models/operation.js +1 -1
- package/lib/models/schema.js +1 -1
- package/lib/models/types.d.ts +5 -0
- package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.d.ts +46 -0
- package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/python/requests.js +1 -1
- package/lib/services/menu/operation.js +1 -1
- package/lib/services/types.d.ts +2 -0
- package/lib/types/open-api.d.ts +1 -0
- package/lib/utils/openapi.js +1 -1
- package/lib-esm/models/field.js +1 -1
- package/lib-esm/models/group.js +1 -1
- package/lib-esm/models/operation.js +1 -1
- package/lib-esm/models/schema.js +1 -1
- package/lib-esm/models/types.d.ts +5 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/__mocks__/mock.d.ts +46 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/__mocks__/mock.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/java/httpclient.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/python/requests.js +1 -1
- package/lib-esm/services/menu/operation.js +1 -1
- package/lib-esm/services/types.d.ts +2 -0
- package/lib-esm/types/open-api.d.ts +1 -0
- package/lib-esm/utils/openapi.js +1 -1
- package/package.json +5 -5
package/lib/models/field.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getField=getField;const utils_1=require("../utils"),schema_1=require("./schema"),example_1=require("./example"),DEFAULT_SERIALIZATION={path:{style:"simple",explode:!1},query:{style:"form",explode:!0},header:{style:"simple",explode:!1},cookie:{style:"form",explode:!0}};function getField(e,l,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getField=getField;const config_1=require("@redocly/config"),utils_1=require("../utils"),schema_1=require("./schema"),example_1=require("./example"),DEFAULT_SERIALIZATION={path:{style:"simple",explode:!1},query:{style:"form",explode:!0},header:{style:"simple",explode:!1},cookie:{style:"form",explode:!0}};function getField(e,i,l,o,t,s,n=l){var d,a,r,c,p,m,u;const{resolved:x}=e.deref(i),v=i.kind||"field",_=i.name||x.name,f=x.in,g=!!x.required;let h,E,A=x.schema,F="";if(!A&&x.in&&x.content){F=Object.keys(x.content)[0];const i=x.content[F];A=i&&(null==i?void 0:i.example)?Object.assign(Object.assign({},e.deref(i.schema,s,!0).resolved),{example:x.example||i.example}):i.schema}const O=(null==t?void 0:t.parentFieldFullPath)?t.parentFieldFullPath+"/"+_:_,y=(0,schema_1.getSchema)({parser:e,schemaOrRef:A||{},pointer:l,options:o,baseRefsStack:s,absolutePointer:i.$ref||(null===(d=x.schema)||void 0===d?void 0:d.absolutePointer)||n,deps:Object.assign(Object.assign({},t),{parentFieldFullPath:O,in:f})}),R=void 0===x.description?(0,utils_1.getValueFromMdParsedExtension)(y,"description")||"":(0,utils_1.getValueFromMdParsedExtension)(x,"description"),b=x.example||y.example,I=x.examples||(null===(r=null===(a=x.content)||void 0===a?void 0:a[F])||void 0===r?void 0:r.examples),L=I?(0,utils_1.mapValues)(I,((i,l)=>(0,example_1.getExamples)({parser:e,infoOrRef:i,mime:l,encoding:x.encoding}))):void 0;F?h=F:x.style?E=x.style:f&&(E=null!==(p=null===(c=DEFAULT_SERIALIZATION[f])||void 0===c?void 0:c.style)&&void 0!==p?p:"form");const P=void 0===x.explode&&f?null===(u=null===(m=DEFAULT_SERIALIZATION[f])||void 0===m?void 0:m.explode)||void 0===u||u:!!x.explode;return{deps:t||{},schema:y,name:_,required:g,description:R,example:b,examples:L,deprecated:void 0===x.deprecated?y.deprecated:x.deprecated,in:f,kind:v,extensions:o.showExtensions?(0,utils_1.extractExtensions)(x,o.showExtensions):void 0,explode:P,style:E,const:(null==y?void 0:y.const)||(null==x?void 0:x.const)||"",serializationMime:h,fieldFullPath:O,[config_1.REDOCLY_TEAMS_RBAC]:x[config_1.REDOCLY_TEAMS_RBAC]||y[config_1.REDOCLY_TEAMS_RBAC]}}
|
|
2
2
|
//# sourceMappingURL=field.js.map
|
package/lib/models/group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getTagOrGroup=getTagOrGroup;const services_1=require("../services"),utils_1=require("../utils"),operation_1=require("../services/menu/operation"),saveTextBeforeHeading_1=require("../utils/saveTextBeforeHeading");function getTagOrGroup(e,i,r){let t;t=(null==r?void 0:r.id)&&"schema"===e?(0,services_1.joinWithSeparator)(r.id,(0,utils_1.safeSlugify)(i.name)):i.id||(0,utils_1.safeSlugify)(i.name);const s=i["x-displayName"]||i.name,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getTagOrGroup=getTagOrGroup;const config_1=require("@redocly/config"),services_1=require("../services"),utils_1=require("../utils"),operation_1=require("../services/menu/operation"),saveTextBeforeHeading_1=require("../utils/saveTextBeforeHeading");function getTagOrGroup(e,i,r){let t;t=(null==r?void 0:r.id)&&"schema"===e?(0,services_1.joinWithSeparator)(r.id,(0,utils_1.safeSlugify)(i.name)):i.id||(0,utils_1.safeSlugify)(i.name);const s=i["x-displayName"]||i.name,o=i.level||1,a=i.isSchema,n=i.ast||void 0,u=(0,saveTextBeforeHeading_1.saveTextBeforeHeading)((0,utils_1.getValueFromMdParsedExtension)(i,"description")||""),l=i.items||[],c=i.externalDocs;return{id:t.toLowerCase(),type:e,parent:r,name:s,level:o,depth:0,isSchema:a,description:u,items:l,ast:n,externalDocs:c,href:(0,operation_1.getHref)({id:t}),[config_1.REDOCLY_TEAMS_RBAC]:i[config_1.REDOCLY_TEAMS_RBAC]||(null==r?void 0:r[config_1.REDOCLY_TEAMS_RBAC])}}
|
|
2
2
|
//# sourceMappingURL=group.js.map
|
package/lib/models/operation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPayloadSample=isPayloadSample,exports.getOperation=getOperation,exports.mergeInMockServer=mergeInMockServer;const theme_1=require("@redocly/theme"),utils_1=require("../utils"),callback_1=require("./callback"),field_1=require("./field"),request_1=require("./request"),security_1=require("./security"),response_1=require("./response"),operation_1=require("../services/menu/operation");function isPayloadSample(e){return"Payload"===e.lang&&"requestBodyContent"in e}function getOperation(e,r,t,s,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPayloadSample=isPayloadSample,exports.getOperation=getOperation,exports.mergeInMockServer=mergeInMockServer;const theme_1=require("@redocly/theme"),config_1=require("@redocly/config"),utils_1=require("../utils"),callback_1=require("./callback"),field_1=require("./field"),request_1=require("./request"),security_1=require("./security"),response_1=require("./response"),operation_1=require("../services/menu/operation");function isPayloadSample(e){return"Payload"===e.lang&&"requestBodyContent"in e}function getOperation(e,r,t,i,s,o){var a,n;const l=r.isWebhook,u={operationDefinition:r,parent:t,pointer:r.pointer,description:(0,utils_1.getValueFromMdParsedExtension)(r,"description"),externalDocs:r.externalDocs,deprecated:!!r.deprecated,httpVerb:r.httpVerb,operationId:r.operationId,path:r.pathName,isWebhook:l,isCallback:Boolean(null==o?void 0:o.isCallback),isEvent:(null==o?void 0:o.isCallback)||l,name:(0,utils_1.getOperationName)(r),defaultExampleName:r.defaultSampleName,[config_1.REDOCLY_TEAMS_RBAC]:r[config_1.REDOCLY_TEAMS_RBAC]||(null==t?void 0:t[config_1.REDOCLY_TEAMS_RBAC]),type:"operation",callbackId:null==o?void 0:o.id,href:s,get callbacks(){return Object.keys(r.callbacks||[]).map((o=>{var a;return(0,callback_1.getCallback)(e,o,null===(a=r.callbacks)||void 0===a?void 0:a[o],u.pointer,i,s,t)}))},get responses(){let t=!1;return Object.keys(r.responses||[]).filter((e=>"default"===e||("success"===(0,utils_1.getStatusCodeType)(e)&&(t=!0),(0,utils_1.isStatusCode)(e)))).map((s=>(0,response_1.getResponse)({parser:e,code:s,defaultAsError:t,infoOrRef:r.responses[s],options:i,isEvent:u.isEvent,operation:u})))},get parameters(){let t=(0,utils_1.mergeParams)(e,r.pathParameters,r.parameters,{pathPointer:utils_1.JsonPointer.dirName(u.pointer),operationPointer:u.pointer}).map((({paramOrRef:r,pointer:t})=>(0,field_1.getField)(e,r,t,i,{operation:u,type:"request"})));return i.sortRequiredPropsFirst&&(t=(0,utils_1.sortByRequired)(t)),(0,utils_1.sortByDeprecated)(t)}};if(null==o?void 0:o.isCallback)u.security=(Array.isArray(r.security)?r.security:[]).map((r=>(0,security_1.getSecurityRequirement)({requirement:r,parser:e}))),u.servers=(0,utils_1.normalizeServers)("",r.servers||r.pathServers||[]),u.id=(0,theme_1.removeLeadingSlash)(s);else{u.id=(0,utils_1.getOperationId)(r,t),u.href=u.href||(0,operation_1.getHref)(u);const s=r.security||e.definition.security;u.security=(Array.isArray(s)?s:[]).map((r=>(0,security_1.getSecurityRequirement)({requirement:r,parser:e}))),u.servers=(0,utils_1.normalizeServers)(e.definitionUrl,mergeInMockServer(r.servers||r.pathServers||e.definition.servers||[],i.mockServer))}i.showExtensions&&(u.extensions=(0,utils_1.extractExtensions)(r,i.showExtensions)),u.requestBody=r.requestBody&&(0,request_1.getRequestBody)({parser:e,infoOrRef:r.requestBody,options:i,operation:u,isEvent:u.isEvent});const p=null===(a=u.requestBody)||void 0===a?void 0:a.content;return u.payload={lang:"Payload",source:"",requestBodyContent:(null==p?void 0:p.hasSample)?p:void 0},u.definitionSamples=r["x-codeSamples"]||[],u.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"}))))||[],u.hasSamples=(null==p?void 0:p.hasSample)||u.definitionSamples.length>0,u.hideReplay=!0===r["x-hideReplay"],u}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
|
package/lib/models/schema.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var __rest=this&&this.__rest||function(e,
|
|
1
|
+
"use strict";var __rest=this&&this.__rest||function(e,i){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&i.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)i.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(t[r[n]]=e[r[n]])}return t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSchema=getSchema;const theme_1=require("@redocly/theme"),config_1=require("@redocly/config"),OpenAPIParser_1=require("../services/OpenAPIParser"),utils_1=require("../utils"),field_1=require("./field");function getSchema({parser:e,schemaOrRef:i,pointer:t,options:r,isChild:n=!1,baseRefsStack:s=[],deps:o,absolutePointer:a}){var l,p,d,c,f,m,u,y,O;const{resolved:h,refsStack:v}=e.deref(i,s,!0),b=i.$ref||t||a||"",g=(0,OpenAPIParser_1.pushRef)(v,b),P=e.mergeAllOf(h,b,g,i.$ref||a),x=P.type||(0,utils_1.detectType)(P),_={operationPointer:(null===(l=o.operation)||void 0===l?void 0:l.pointer)||a||"",schemaOrRef:i,isChild:n,typePrefix:"",pointer:b,absolutePointer:a,refsStack:g,rawSchema:h,type:x,isCircular:!!P["x-circular-ref"],title:P.title||(0,utils_1.isNamedDefinition)(b)&&utils_1.JsonPointer.baseName(b)||"",description:(0,utils_1.getValueFromMdParsedExtension)(P,"description")||"",format:P.format,enum:P.enum||[],example:P.example,deprecated:!!P.deprecated,pattern:P.pattern,externalDocs:P.externalDocs,displayFormat:P.format,isPrimitive:(0,utils_1.isPrimitiveType)(P,x),constraints:(0,utils_1.humanizeConstraints)(P),default:P.default,readOnly:!!P.readOnly,writeOnly:!!P.writeOnly,const:P.const||"",contentEncoding:P.contentEncoding,contentMediaType:P.contentMediaType,minItems:P.minItems,maxItems:P.maxItems,nullable:P.nullable||P["x-nullable"],schema:P,displayType:"",items:void 0,extensions:void 0,oneOfType:"",discriminatorProp:void 0,oneOf:void 0,[config_1.REDOCLY_TEAMS_RBAC]:P[config_1.REDOCLY_TEAMS_RBAC],"x-enumDescriptions":(0,utils_1.getValueFromMdParsedExtension)(P,"x-enumDescriptions"),get fields(){if(hasType(_,"object")||hasType(_,"array")&&(Array.isArray(P.items)||Array.isArray(P.prefixItems)))return buildFields(e,P,b,r,g,o)}};if((P.nullable||P["x-nullable"])&&(Array.isArray(_.type)&&!_.type.some((e=>null===e||"null"===e))?_.type=[..._.type,"null"]:Array.isArray(_.type)||null===_.type&&"null"===_.type||(_.type=[_.type,"null"])),_.displayType=Array.isArray(_.type)?_.type.map((e=>null===e?"null":e)).join(" or "):_.type,_.isCircular)return _;if(P.if&&P.then||P.if&&P.else){const{oneOf:i,oneOfType:t}=initConditionalOperators({schema:P,parser:e,pointer:b,options:r,deps:o,refsStack:g});return _.oneOf=i,_.oneOfType=t,_}if(!n&&void 0!==getDiscriminator(P)){const{oneOf:i,discriminatorProp:t}=initDiscriminator({schema:P,parser:e,deps:o,mergedSchema:P,options:r,pointer:b,refsStack:g});return _.oneOf=i,_.discriminatorProp=t,_}if(n&&Array.isArray(P.oneOf)&&P.oneOf.find((e=>e.$ref===b))&&delete P.oneOf,void 0!==P.oneOf){const{oneOf:i,displayType:t}=initOneOf({schemaOneOf:P.oneOf,parser:e,deps:o,options:r,pointer:b,refsStack:g,schema:P});return _.oneOfType="One of",i&&(_.oneOf=i),_.displayType=t,void 0!==P.anyOf&&console.warn(`oneOf and anyOf are not supported on the same level. Skipping anyOf at ${b}`),_}if(void 0!==P.anyOf){const{oneOf:i,displayType:t}=initOneOf({schemaOneOf:P.anyOf,parser:e,deps:o,options:r,pointer:b,refsStack:g,schema:P});return i&&(_.oneOf=i),_.displayType=t,_.oneOfType="Any of",_}if(hasType(_,"array")&&(P.items&&(_.items=getSchema({parser:e,schemaOrRef:P.items,pointer:b+"/items",options:r,baseRefsStack:g,deps:o,absolutePointer:utils_1.JsonPointer.join(P.absolutePointer||"",["items"])})),_.displayType=P.prefixItems||Array.isArray(P.items)?"items":(0,utils_1.pluralizeType)((null===(p=_.items)||void 0===p?void 0:p.displayType)||_.displayType),_.displayFormat=(null===(d=_.items)||void 0===d?void 0:d.format)||"",_.typePrefix=(null===(c=_.items)||void 0===c?void 0:c.typePrefix)||"Array of ",_.title=_.title||(null===(f=_.items)||void 0===f?void 0:f.title)||"",_.isPrimitive=void 0!==(null===(m=_.items)||void 0===m?void 0:m.isPrimitive)?null===(u=_.items)||void 0===u?void 0:u.isPrimitive:_.isPrimitive,void 0===_.example&&void 0!==(null===(y=_.items)||void 0===y?void 0:y.example)&&(_.example=[_.items.example]),(null===(O=_.items)||void 0===O?void 0:O.isPrimitive)&&(_.enum=_.items.enum,_["x-enumDescriptions"]=(0,utils_1.getValueFromMdParsedExtension)(_.items,"x-enumDescriptions")),Array.isArray(_.type))){const e=_.type.filter((e=>"array"!==e));e.length&&(_.displayType+=` or ${e.join(" or ")}`)}return r.showExtensions&&(_.extensions=(0,utils_1.extractExtensions)(P,r.showExtensions)),_}function initDiscriminator({schema:e,parser:i,pointer:t,options:r,refsStack:n,deps:s,mergedSchema:o}){const a=getDiscriminator(e),l=null==a?void 0:a.propertyName,p=i.findDerived([...o["x-parentRefs"]||[],t]);if(e.oneOf)for(const i of e.oneOf){if(void 0===i.$ref)continue;const e=utils_1.JsonPointer.baseName(i.$ref);p[i.$ref]=e}const d=(null==a?void 0:a.mapping)||{};let c=(null==a?void 0:a["x-explicitMappingOnly"])||!1;0===Object.keys(d).length&&(c=!1);const f={};for(const e in d){const i=d[e];Array.isArray(f[i])?f[i].push(e):f[i]=[e]}const m=c?Object.assign({},f):Object.assign(Object.assign({},p),f);let u=[];for(const e of Object.keys(m)){const i=m[e];if(Array.isArray(i))for(const t of i)u.push({$ref:e,name:t});else u.push({$ref:e,name:i})}const y=Object.keys(d);0!==y.length&&(u=u.sort(((e,i)=>{const t=y.indexOf(e.name),r=y.indexOf(i.name);return t<0&&r<0?e.name.localeCompare(i.name):t<0?1:r<0?-1:t-r})));return{oneOf:u.map((({$ref:e,name:t},a)=>{const l=getSchema({parser:i,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=t,l})),discriminatorProp:l}}function initOneOf({schemaOneOf:e,parser:i,refsStack:t,pointer:r,schema:n,options:s,deps:o}){const a=e.map(((e,a)=>{const{resolved:l,refsStack:p}=i.deref(e,t,!0),d=i.mergeAllOf(l,r+"/oneOf/"+a,p),c=(0,utils_1.isNamedDefinition)(e.$ref)&&!d.title?utils_1.JsonPointer.baseName(e.$ref):`${d.title||""}${d.const&&JSON.stringify(d.const)||""}`;return getSchema({parser:i,schemaOrRef:Object.assign(Object.assign({},d),{title:c,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 i=e.typePrefix+(e.title?`${e.title} (${e.displayType})`:e.displayType);return i.indexOf(" or ")>-1&&(i=`(${i})`),i})).join(" or ");return{oneOf:a,displayType:l}}function initConditionalOperators({schema:e,parser:i,pointer:t,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:i,schemaOrRef:Object.assign({},e),pointer:t+"/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,i,t){return e||(console.warn(`Field "${i}" is invalid, skipping.\n Field must be an object but got ${typeof e} at "${t}"`),{})}function buildFields(e,i,t,r,n,s){let o=i.properties||(hasType(i,"array")?i.prefixItems||i.items:void 0)||{};const a=i.patternProperties||{},l=i.additionalProperties||i.unevaluatedProperties,p=i.prefixItems?i.items:i.additionalItems,d=i.default||{};let c=Object.keys(o).map((a=>{var l;const p=normalizeField(o[a],a,t),c=void 0!==i.required&&i.required.indexOf(a)>-1;return(0,field_1.getField)(e,{name:i.properties?a:`[${a}]`,required:c,schema:Object.assign(Object.assign({},p),{example:(null===(l=i.example)||void 0===l?void 0:l[a])||p.example,default:void 0===p.default&&d?d[a]:p.default})},t+"/properties/"+a,r,s,n,utils_1.JsonPointer.join(i.absolutePointer||"",["properties",a]))}));return r.sortRequiredPropsFirst&&(c=(0,utils_1.sortByRequired)(c,i.required)),c.push(...Object.keys(a).map((i=>{const o=normalizeField(a[i],i,t);return(0,field_1.getField)(e,{name:i,required:!1,schema:o,kind:"patternProperties"},`${t}/patternProperties/${i}`,r,s,n)}))),((0,theme_1.isObject)(l)||!0===l)&&c.push((0,field_1.getField)(e,{name:((0,theme_1.isObject)(l)&&l["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===l?{}:l,kind:"additionalProperties"},t+"/additionalProperties",r,s,n,utils_1.JsonPointer.join(i.absolutePointer||"",["additionalProperties"]))),c.push(...buildAdditionalItems({parser:e,schema:p,fieldsCount:c.length,$ref:t,options:r,refsStack:n,deps:s})),(0,utils_1.sortByDeprecated)(c)}function buildAdditionalItems({parser:e,schema:i=!1,fieldsCount:t,$ref:r,options:n,refsStack:s,deps:o}){return"boolean"==typeof i?i?[(0,field_1.getField)(e,{name:`[${t}...]`,schema:{},kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]:Array.isArray(i)?[...i.map(((i,a)=>(0,field_1.getField)(e,{name:`[${t+a}]`,schema:i,kind:"additionalItems"},`${r}/additionalItems/${a}`,n,o,s)))]:(0,theme_1.isObject)(i)?[(0,field_1.getField)(e,{name:`[${t}...]`,schema:i,kind:"additionalItems"},`${r}/additionalItems`,n,o,s)]:[]}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function hasType(e,i){return e.type===i||Array.isArray(e.type)&&e.type.includes(i)}
|
|
2
2
|
//# sourceMappingURL=schema.js.map
|
package/lib/models/types.d.ts
CHANGED
|
@@ -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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.serverVariablesOptions=exports.source=exports.originalOptions=void 0;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"}}}}}};exports.originalOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:spec},exports.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"}},exports.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
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.serverVariablesOptions=exports.source=exports.originalOptions=void 0;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"}}}}}};exports.originalOptions={withImports:!0,withComments:!1,skipOptionalParameters:!1,withOAuth2Call:!0,spec:spec},exports.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"}]}}},exports.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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;const code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),hasQueryParams=e=>!(!e.uriObj.query||!Object.keys(e.uriObj.query).length),getBody=e=>e.postData&&e.postData.mimeType===constants_2.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:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;const code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),hasQueryParams=e=>!(!e.uriObj.query||!Object.keys(e.uriObj.query).length),getBody=e=>e.postData&&e.postData.mimeType===constants_2.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 p=Object.assign({indent:" ",withWrapper:!0},t),i=new code_builder_1.CodeBuilder({indentation:p.indent,variablesPrefix:p.variablesPrefix,capitalize:!0,lang:constants_1.Lang.JAVA});if(p.withComments&&addComments(i,e),p.withImports&&addImports(i,e),p.withWrapper&&(i.push("public class App {"),i.push(1,"public static void main(String[] args) throws Exception {"),i.push(2,"var httpClient = HttpClient.newBuilder().build();"),i.blank()),null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){const t=new __1.HTTPSnippet(null===(n=e.securityOAuth2ExtraCalls)||void 0===n?void 0:n[0]).convert(a,s,Object.assign(Object.assign({},p),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));i.push(t),i.blank(),i.push(2,"var oauth2Response = httpClient.send(oauth2Request, HttpResponse.BodyHandlers.ofString());"),i.push(2,'var accessToken = new JSONObject(oauth2Response.body()).getString("access_token");'),i.blank()}if(e.postData)switch((0,utils_1.normalizeMimeType)(e.postData.mimeType)){case constants_2.MediaTypes.URL_ENCODED:e.postData.params&&(i.push(2,"HashMap<String, String> params = new HashMap<>();"),e.postData.params.forEach((e=>{i.push(2,'params.put("%s", "%s");',e.name,e.value)})),i.blank(),i.push(2,"var form = params.keySet().stream()"),i.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),i.push(3,'.collect(Collectors.joining("&"));'),i.blank());break;case constants_2.MediaTypes.JSON:e.postData.jsonObj&&(i.push(2,`var payload = String.join("\\n"\n ${(0,code_helpers_1.addIndentation)(JSON.stringify(e.postData.jsonObj,null,1).replace(/"/g,'\\"').replace(/^/gm,', "').replace(/$/gm,'"'),{level:3,indent:p.indent,firstLine:!1})}`),i.push(2,");"),i.blank());break;case constants_2.MediaTypes.XML:e.postData.text&&(i.push(2,'var payload = String.join("\\n"'),e.postData.text.trim().split("\n").forEach((e=>{const t=e.replace(/"/g,'\\"');i.push(3,`"${t}", `)})),i.push(2,");"),i.blank());break;case constants_2.MediaTypes.MULTIPART:e.postData.params&&(i.push(2,"var multipartBody = MultipartBodyPublisher.newBuilder();"),e.postData.params&&e.postData.params.forEach((e=>{i.push(2,'multipartBody.append("%s", "%s");',e.name,e.value)})),i.push(2,"var body = multipartBody.build();"),i.blank())}if(hasQueryParams(e)){i.push(2,"HashMap<String, String> params = new HashMap<>();");for(const[t,a]of Object.entries(e.uriObj.query))i.push(2,'params.put("%s", "%s");',t,a);i.blank(),i.push(2,"var query = params.keySet().stream()"),i.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),i.push(3,'.collect(Collectors.joining("&"));'),i.blank()}i.push(2,`var ${i.var("host")} = "%s";`,e.uriObj.protocol+"//"+e.uriObj.host),(0,code_helpers_1.printUrlVariablesDeclarations)(e,i,2);const l=Object.assign(Object.assign({},e),{pathname:e.uriObj.pathname});i.push(2,`var ${i.var("pathname")} = %s;`,(0,code_helpers_1.buildUrlExpression)(l,i)),i.push(2,`var ${i.var("request")} = HttpRequest.newBuilder()`),"PATCH"===e.method.toUpperCase()?i.push(3,'.method("PATCH", %s)',getBody(e)):i.push(3,".%s(%s)",e.method.toUpperCase(),getBody(e)),i.push(3,`.uri(URI.create(${i.var("host")} + ${i.var("pathname")} %s))`,hasQueryParams(e)?"+ '?' + query":""),(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length)&&(e.allHeaders.Authorization='"Bearer " + accessToken');const u=Object.keys(e.allHeaders);if(u.length&&u.forEach((t=>{var a;i.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;i.push(3,`.header("Authorization", "Basic " + Base64.getEncoder().encodeToString(("${t}:${a}").getBytes()))`)}return i.push(3,".build();"),p.withWrapper&&(i.blank(),i.push(2,"var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());"),i.blank(),i.push(2,"System.out.println(response.body());"),i.push(1,"}"),i.push("}")),i.join()};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.*;"),((0,utils_1.normalizeMimeType)(null===(a=t.postData)||void 0===a?void 0:a.mimeType)===constants_2.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()}exports.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 )"},exports.default=handler;
|
|
2
2
|
//# sourceMappingURL=httpclient.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),code_builder_1=require("../../helpers/code-builder"),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),__1=require("../.."),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),handler=function(e,t,{target:s,client:a}){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),code_builder_1=require("../../helpers/code-builder"),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),__1=require("../.."),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),handler=function(e,t,{target:s,client:a}){var o,n,r,i;const l=Object.assign({indent:" "},t),{level:u=0}=l,p=new code_builder_1.CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:constants_1.Lang.PYTHON});l.withComments&&addComments(p),l.withImports&&p.push("import requests").blank();let d,h,c,_=!1,b=e.allHeaders;if(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length){const t=new __1.HTTPSnippet(null===(n=e.securityOAuth2ExtraCalls)||void 0===n?void 0:n[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));p.push(t),p.blank(),b=b||{},b.Authorization='"Bearer " + oauth2_data["access_token"]',_=!0}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,p),p.push(`${p.var("url").toLowerCase()} = %s`,(0,code_helpers_1.buildUrlExpression)(e,p)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),p.push(d).blank()}const v=(0,utils_1.normalizeMimeType)(null===(r=e.postData)||void 0===r?void 0:r.mimeType);if(e.postData)switch(v){case constants_2.MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case constants_2.MediaTypes.JSON:e.postData.jsonObj&&(h=(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case constants_2.MediaTypes.MULTIPART:const t=[];if(e.postData.params)for(const s of e.postData.params)t.push(`"${s.name}": "${s.value}"`);if(t.length){c=`data = {\n${t.map((e=>` ${e}`)).join(",\n")}\n}`}c&&p.push(c).blank();break;default:e.postData.text&&(h=`'''\n${(0,code_helpers_1.addIndentation)(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let $;h&&p.push(`${p.var("payload").toLowerCase()} = %s`,h).blank();const f=Object.keys(b).length,C=(e,t)=>"Authorization"===e&&_?t:`"${t}"`;if(1===f)for($ in b)p.push(`${p.var("headers").toLowerCase()} = {"${$}": ${C($,b[$])}}`).blank();else if(f>1){let e=1;for($ in p.push(`${p.var("headers").toLowerCase()} = {`),b)e++!==f?p.push(1,`"${$}": ${C($,b[$])},`):p.push(1,`"${$}": ${C($,b[$])}`);p.push(0,"}").blank()}const j=e.method.toLowerCase();let m=(0,util_1.format)(`${p.var("response").toLowerCase()} = requests.${j}(${p.var("url").toLowerCase()}`);if(v===constants_2.MediaTypes.MULTIPART&&c&&(m+=", data=data"),h){m+=`, ${v===constants_2.MediaTypes.JSON?"json":"data"}=${p.var("payload").toLowerCase()}`}return f>0&&(m+=`, headers=${p.var("headers").toLowerCase()}`),d&&(m+=`, params=${p.var("query").toLowerCase()}`),e.basicAuth&&(m+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),m+=")",p.push(m).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?p.push("if response.status_code == 204:").push(u+1,'print("success")').push("else:").push(u+1,`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(u+1,`print(${p.var("data").toLowerCase()})`):p.push(`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(`print(${p.var("data").toLowerCase()})`),p.join()};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")}exports.default=handler;
|
|
2
2
|
//# sourceMappingURL=requests.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getOperationsItems=getOperationsItems,exports.getHref=getHref;const utils_1=require("../../utils");function getOperationsItems(e,t,r){if(0===t.operations.length)return[];const o=[],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getOperationsItems=getOperationsItems,exports.getHref=getHref;const config_1=require("@redocly/config"),utils_1=require("../../utils");function getOperationsItems(e,t,r){if(0===t.operations.length)return[];const o=[],i=[];for(const s of t.operations){const t=(0,utils_1.getOperationId)(s,e),n={id:t,type:"operation",parent:e,operationDefinition:s,depth:r,name:(0,utils_1.getOperationName)(s),httpVerb:s.httpVerb,path:s.pathName,items:[],isWebhook:s.isWebhook,operationId:s.operationId,badges:s["x-badges"]||[],href:getHref({id:t}),deprecated:!!s.deprecated,[config_1.REDOCLY_TEAMS_RBAC]:s[config_1.REDOCLY_TEAMS_RBAC]||(null==e?void 0:e[config_1.REDOCLY_TEAMS_RBAC])};s.isWebhook?i.push(n):o.push(n)}return[...o.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated))),...i.sort(((e,t)=>Number(e.deprecated)-Number(t.deprecated)))]}function getHref({id:e}){return(0,utils_1.encodeBackSlashes)(`/${e}`.toLowerCase())}
|
|
2
2
|
//# sourceMappingURL=operation.js.map
|
package/lib/services/types.d.ts
CHANGED
|
@@ -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[];
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -334,6 +334,7 @@ export interface OpenAPITag extends ParsedDescription {
|
|
|
334
334
|
description?: string;
|
|
335
335
|
externalDocs?: OpenAPIExternalDocumentation;
|
|
336
336
|
'x-displayName'?: string;
|
|
337
|
+
'x-rbac'?: Record<string, unknown>;
|
|
337
338
|
}
|
|
338
339
|
export interface OpenAPIExternalDocumentation extends ParsedDescription {
|
|
339
340
|
description?: string;
|