@redocly/openapi-docs 3.18.0-custom.0 → 3.18.0-custom.1

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.
Files changed (40) hide show
  1. package/dist/redocly-openapi-docs.min.js +2306 -2211
  2. package/lib/components/Discriminator/Discriminator.d.ts +0 -1
  3. package/lib/components/Discriminator/Discriminator.js +2 -2
  4. package/lib/components/PayloadSamples/ExampleValue.js +1 -1
  5. package/lib/components/RequestParameters/RequestParameters.js +1 -1
  6. package/lib/components/Schema/ObjectSchema.js +1 -1
  7. package/lib/components/Schema/Schema.js +2 -2
  8. package/lib/components/Schema/types.d.ts +1 -3
  9. package/lib/components/TagItem/Breadcrumbs.d.ts +11 -0
  10. package/lib/components/TagItem/Breadcrumbs.js +41 -0
  11. package/lib/components/TagItem/OperationNavigationItems.d.ts +4 -2
  12. package/lib/components/TagItem/OperationNavigationItems.js +20 -5
  13. package/lib/components/TagItem/OperationsNavigation.js +27 -2
  14. package/lib/components/TagItem/TagItem.js +17 -16
  15. package/lib/components/common/Badges.js +10 -8
  16. package/lib/components/common/linkify.js +7 -2
  17. package/lib/components/common/panels.js +1 -1
  18. package/lib/constants.d.ts +1 -0
  19. package/lib/constants.js +1 -1
  20. package/lib/models/field.js +1 -1
  21. package/lib/models/group.js +1 -1
  22. package/lib/models/mediaType.js +1 -1
  23. package/lib/models/operation.js +1 -1
  24. package/lib/services/code-samples/generator.d.ts +1 -0
  25. package/lib/services/code-samples/generator.js +1 -1
  26. package/lib/services/menu/builder.js +1 -1
  27. package/lib/services/menu/operation.d.ts +2 -2
  28. package/lib/services/menu/operation.js +1 -1
  29. package/lib/services/menu/tags.d.ts +1 -0
  30. package/lib/services/menu/tags.js +3 -3
  31. package/lib/types/open-api.d.ts +11 -2
  32. package/lib/utils/calculateMaxLength.d.ts +6 -0
  33. package/lib/utils/calculateMaxLength.js +1 -0
  34. package/lib/utils/getBreadcrumbs.d.ts +7 -0
  35. package/lib/utils/getBreadcrumbs.js +1 -0
  36. package/lib/utils/index.d.ts +2 -0
  37. package/lib/utils/index.js +1 -1
  38. package/lib/utils/openapi.d.ts +1 -0
  39. package/lib/utils/openapi.js +1 -1
  40. package/package.json +7 -7
@@ -1 +1 @@
1
- import*as ne from"openapi-sampler";import L from"deepmerge";import{isObject as oe}from"@redocly/theme/core/openapi";import{areArraysEqual as ce,serializeParameterValue as I,getSecurityDetails as ie,getParameterValue as $,queryString as P,isArrayOfObjects as ue,deleteEmptyArrayItem as le}from"../../utils/index.js";import{normalizeMimeType as pe,arrayMergeStrategy as M}from"../utils.js";import{MediaTypes as m}from"../../constants.js";import{HTTPSnippet as me}from"./httpsnippet/index.js";import{getActiveMediaType as de}from"../../models/mediaContent.js";import J from"./httpsnippet/helpers/string-utility.js";function C(t,a,o){try{return ne.sample(t,a,o)}catch(n){return console.error(`Error sampling schema: ${n.message}`),null}}function fe(t,a){return t.find(o=>{const n=o.schemes.map(s=>s.id);return ce(n,a||[])})}function ye(t,{exampleName:a="",skipOptionalParameters:o=!1,withOAuth2Call:n=!1,spec:s,generatedPayloadSamplesMaxDepth:r=8,pathParams:i={},properties:u={},activeMimeName:c=""},{environment:y,requestValues:k,activeSecuritySchemeIds:T}){const l=y.server,b=t.servers.find(e=>e.url===l)||t.servers[0],w=fe(t.security,T),{securityHeaders:R,securityCookies:B,securityQueries:F,securityOAuth2ExtraCalls:X,basicAuth:K}=he(w||t.security?.[0],n,y),p=t?.requestBody?.content&&de(t.requestBody.content,c),g={skipNonRequired:o,skipReadOnly:!0,maxSampleDepth:r,quiet:!0},S=k;let H=!1;const N=t.parameters.filter(e=>e.in==="header").filter(e=>!(o&&!e.required)).map(e=>({name:e.name,value:S.header?.[e.name]||$("header",e.name)||e.serverValues?.[l]?.example||e.example||I(e,C(e.schema.rawSchema,g,s))})).map(e=>(p?.name&&e.name.toLowerCase()==="content-type"&&(H=!0,e.value=p.name),e)).concat(R);!H&&p?.name&&N.unshift({name:"Content-Type",value:p?.name});const Q=t.parameters.filter(e=>e.in==="cookie").filter(e=>!(o&&!e.required)).map(e=>P.parse(I(e,e.serverValues?.[l]?.example||e.example||C(e.schema.rawSchema,g,s)))).reduce((e,f)=>{for(const[h,_]of Object.entries(f))e.push({name:h,value:String(S.cookie?.[h]||_)});return e},[]).concat(B),G=t.parameters.filter(e=>e.in==="query").filter(e=>!(o&&!e.required)).map(e=>P.parse(I(e,e.serverValues?.[l]?.example||e.example||C(e.schema.rawSchema,g,s)))).reduce((e,f)=>{for(const[h,_]of Object.entries(f))e.push({name:h,value:ue(S.query?.[h])&&JSON.stringify(le(S.query?.[h]))||String(S.query?.[h]||_)});return e},[]).concat(F),W=b?.url.replace(/\/$/,""),Z=t.path.replace(/^\//,""),ee=`${W}/${Z}`,te=t.parameters.filter(e=>e.in==="path").reduce((e,f)=>{const{in:h,name:_}=f;return e[_]=S.path?.[_]||f.serverValues?.[l]?.example||f.example||i[_]||$(h,_),e},{}),q=p?.name.toLowerCase(),E=p?.examples?.[a]||p?.formExamples?.[a],re={...p?.formExamples||{},...p?.examples||{}},[x]=Object.values(re),U=E?.serverValues?.[l]?.value||x?.serverValues?.[l]?.value,D=e=>!e||typeof e!="object"||!p?.schema?.rawSchema?null:C(Oe(p.schema.rawSchema,e),{...g,format:"xml"},s),v=(()=>{if(S?.body)return S.body;if(q===m.XML){const e=U||E?.value||x?.value;if(typeof e=="string")return e;const f=D(U)||D(E?.value)||D(x?.value);if(f)return f;if(p?.schema)return C(p.schema.rawSchema,{...g,format:"xml"},s)}else{const e=p?.schema&&C(p.schema.rawSchema,{...g,format:"json"},s);return U||E?.value||x?.value||e}return""})();let O="",z=[];switch(pe(q)){case m.JSON:O=JSON.stringify(j(v,u));break;case m.XML:O=v;break;case m.MULTIPART:case m.URL_ENCODED:typeof v=="string"?O=v:(O=P.stringify(j(v,u)),z=Y(j(v,u)));break;default:O=String(v||"")}const ae=O?{mimeType:p?.name||m.OCTET_STREAM,text:O,params:z}:void 0,se=t.responses.map(e=>e.code);return{method:t.httpVerb,url:ee,httpVersion:"HTTP/1.1",cookies:Q,headers:N,queryString:G,postData:ae,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:X,basicAuth:K,pathParameters:te,serverVariables:y,allResponseCodes:se}}const d={withImports:!0,withComments:!1},A={curl:{code:"shell",defaultTarget:"curl",defaultOptions:{...d,short:!0}},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:{...d,withImports:!1}},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:{...d}},Python:{code:"python",defaultTarget:"requests",defaultOptions:{...d}},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:{...d}},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:{...d}},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:{...d}},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:{...d}},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:{...d}},PHP:{code:"php",defaultTarget:"curl",defaultOptions:{...d}},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:{...d}},R:{code:"r",defaultTarget:"httr",defaultOptions:{...d}}};function Ue({lang:t,operation:a,exampleName:o,pathParams:n,properties:s,options:r={},environment:i,translate:u}){try{const{skipOptionalParameters:c,withOAuth2Call:y,spec:k,generatedPayloadSamplesMaxDepth:T,store:l,activeMimeName:b}=r,w=ye(a,{exampleName:o,pathParams:n,properties:s,skipOptionalParameters:c,withOAuth2Call:y,spec:k,generatedPayloadSamplesMaxDepth:T,activeMimeName:b},{environment:i,requestValues:l.requestValues,activeSecuritySchemeIds:l.activeSecuritySchemeIds}),R=new me(w);return A[t]?R.convert(A[t].code,A[t].defaultTarget,{...A[t].defaultOptions,...r}):u("openapi.unsupportedLanguage","Language is not supported.")}catch(c){return console.error(c),u("openapi.failedToGenerateCodeSample","Failed to generate code sample.")}}function he(t,a,o){const n={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},s=o?.server;for(const r of t?.schemes||[]){const i=ie(r.id,o),u=s&&r.serverValues&&r.serverValues[s],c={access_token:u?.["x-defaultAccessToken"]||r["x-defaultAccessToken"],token_type:u?.["x-defaultTokenType"]||r["x-defaultTokenType"],client_id:u?.["x-defaultClientId"]||r["x-defaultClientId"],client_secret:u?.["x-defaultClientSecret"]||r["x-defaultClientSecret"]},y=u?.["x-defaultUsername"]||r["x-defaultUsername"],k=u?.["x-defaultPassword"]||r["x-defaultPassword"],T=u&&"scopes"in u?u.scopes||[]:r.scopes||[];switch(r.type){case"openIdConnect":n.securityHeaders?.push({name:"Authorization",value:c.access_token?`${c.token_type||"Bearer"} ${c.access_token}`:i.token?`${c.token_type||i.token.token_type||"Bearer"} ${i.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const l=c.access_token?`${c.token_type||"Bearer"} ${c.access_token}`:i.token?`${i.token.token_type||"Bearer"} ${i.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";r.flows.deviceAuthorization&&a?n.securityOAuth2ExtraCalls.push(Se(r.flows.deviceAuthorization,T)):r.flows.clientCredentials&&a?n.securityOAuth2ExtraCalls.push(Te(r.flows.clientCredentials,T,{...i,client_id:c.client_id||i.client_id,client_secret:c.client_secret||i.client_secret})):r.flows.password&&a&&n.securityOAuth2ExtraCalls.push(_e(r.flows.password,T,{...i,client_id:c.client_id||i.client_id,client_secret:c.client_secret||i.client_secret})),n.securityHeaders?.push({name:"Authorization",value:l});break}case"apiKey":{const l=c.access_token||i.raw||"YOUR_API_KEY_HERE";r.in==="header"&&n.securityHeaders?.push({name:r.name,value:l}),r.in==="cookie"&&n.securityCookies.push({name:r.name,value:l}),r.in==="query"&&n.securityQueries.push({name:r.name,value:l});break}case"http":if(r.scheme==="basic")n.basicAuth={username:y||i.username||`<${J.toSnakeCase("Username")}>`,password:k||i.password||`<${J.toSnakeCase("Password")}>`};else{const l=c?.access_token||i.token?.access_token||`<YOUR_${r.bearerFormat||"TOKEN"}_HERE>`;n.securityHeaders?.push({name:"Authorization",value:`${ve(r.scheme||"bearer")} ${l}`})}break}}return n}function Se(t,a){const o=t["x-defaultClientId"]??"YOUR_CLIENT_ID",{tokenUrl:n,deviceAuthorizationUrl:s}=t;return{method:"POST",url:s,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:m.URL_ENCODED},{name:"Accept",value:m.JSON}],queryString:[],postData:{mimeType:m.URL_ENCODED,text:"",params:[{name:"client_id",value:o},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"deviceAuthorization",tokenUrl:n,clientId:o}}function _e(t,a,o){const{tokenUrl:n}=t,s=o.client_id??"YOUR_CLIENT_ID";return{method:"POST",url:t.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:m.URL_ENCODED},{name:"Accept",value:m.JSON}],queryString:[],postData:{mimeType:m.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:s},{name:"client_secret",value:o.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:o.username||"<username>"},{name:"password",value:o.password||"<password>"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"password",tokenUrl:n,clientId:s}}function Te(t,a,o){const{tokenUrl:n}=t,s=o.client_id??"YOUR_CLIENT_ID";return{method:"POST",url:t.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:m.URL_ENCODED},{name:"Accept",value:m.JSON}],queryString:[],postData:{mimeType:m.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:s},{name:"client_secret",value:o.client_secret||"YOUR_CLIENT_SECRET"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"clientCredentials",tokenUrl:n,clientId:s}}function j(t,a){if(t){if(oe(t))return Object.keys(t).length>0&&Object.keys(a).length===0?t:L(t,a,{arrayMerge:M});try{return L(JSON.parse(t),a,{arrayMerge:M})}catch{return!1}}return!1}function Y(t,a=""){const o=[];for(const[n,s]of Object.entries(t)){const r=a?`${a}[${n}]`:n;if(typeof s=="object"&&s!==null)o.push(...Y(s,r));else{const i=Array.isArray(t)&&typeof s=="string"&&a?a:r;o.push({name:i,value:String(s)})}}return o}function V(t){return t!==void 0}function ve(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Oe(t,a){if(!t||typeof t!="object"||!a||typeof a!="object")return t;const o=JSON.parse(JSON.stringify(t));function n(s,r){if(!(!s||!r||typeof s!="object"||typeof r!="object")&&s.properties){for(const i in s.properties)if(r[i]!==void 0){const u=s.properties[i],c=r[i];if(u.type==="object"&&typeof c=="object"&&!Array.isArray(c))n(u,c);else if(u.type==="array"&&Array.isArray(c)&&c.length>0){const y=c[0];u.items&&u.items.properties&&n(u.items,y)}else u.example=c}}}return n(o,a),o}export{ve as capitalizeFirst,Ue as getCodeSample,j as getDataRequest,V as isDefined,C as safeSample};
1
+ import*as ce from"openapi-sampler";import $ from"deepmerge";import{isObject as ue}from"@redocly/theme/core/openapi";import{areArraysEqual as le,serializeParameterValue as P,getSecurityDetails as pe,getParameterValue as M,queryString as I,isArrayOfObjects as me,deleteEmptyArrayItem as de}from"../../utils/index.js";import{normalizeMimeType as fe,arrayMergeStrategy as J}from"../utils.js";import{MediaTypes as d}from"../../constants.js";import{HTTPSnippet as ye}from"./httpsnippet/index.js";import{getActiveMediaType as he}from"../../models/mediaContent.js";import Y from"./httpsnippet/helpers/string-utility.js";function C(e,a,o){try{return ce.sample(e,a,o)}catch(n){return console.error(`Error sampling schema: ${n.message}`),null}}function Se(e,a){return e.find(o=>{const n=o.schemes.map(s=>s.id);return le(n,a||[])})}function _e(e,{exampleName:a="",skipOptionalParameters:o=!1,withOAuth2Call:n=!1,spec:s,generatedPayloadSamplesMaxDepth:r=8,pathParams:c={},properties:u={},activeMimeName:i=""},{environment:h,requestValues:k,activeSecuritySchemeIds:_}){const p=h.server,b=e.servers.find(t=>t.url===p)||e.servers[0],w=Se(e.security,_),{securityHeaders:R,securityCookies:Q,securityQueries:F,securityOAuth2ExtraCalls:X,basicAuth:K}=Te(w||e.security?.[0],n,h),m=e?.requestBody?.content&&he(e.requestBody.content,i),v={skipNonRequired:o,skipReadOnly:!0,maxSampleDepth:r,quiet:!0},S=k;let H=!1;const N=e.parameters.filter(t=>t.in==="header").filter(t=>!(o&&!t.required)).map(t=>({name:t.name,value:S.header?.[t.name]||M("header",t.name)||t.serverValues?.[p]?.example||t.example||P(t,C(t.schema.rawSchema,v,s))})).map(t=>(m?.name&&t.name.toLowerCase()==="content-type"&&(H=!0,t.value=m.name),t)).concat(R);!H&&m?.name&&N.unshift({name:"Content-Type",value:m?.name});const G=e.parameters.filter(t=>t.in==="cookie").filter(t=>!(o&&!t.required)).map(t=>I.parse(P(t,t.serverValues?.[p]?.example||t.example||C(t.schema.rawSchema,v,s)))).reduce((t,l)=>{for(const[O,y]of Object.entries(l))t.push({name:O,value:String(S.cookie?.[O]||y)});return t},[]).concat(Q);function q(t){return e.parameters.filter(l=>l.in===t).filter(l=>!(o&&!l.required)).map(l=>I.parse(P(l,l.serverValues?.[p]?.example||l.example||C(l.schema.rawSchema,v,s)))).reduce((l,O)=>{for(const[y,ie]of Object.entries(O))l.push({name:y,value:me(S[t]?.[y])&&JSON.stringify(de(S[t]?.[y]))||String(S[t]?.[y]||ie)});return l},[]).concat(F)}const W=e.parameters.some(t=>t.in==="querystring"),Z=q(W?"querystring":"query"),ee=b?.url.replace(/\/$/,""),te=e.path.replace(/^\//,""),re=`${ee}/${te}`,ae=e.parameters.filter(t=>t.in==="path").reduce((t,l)=>{const{in:O,name:y}=l;return t[y]=S.path?.[y]||l.serverValues?.[p]?.example||l.example||c[y]||M(O,y),t},{}),z=m?.name.toLowerCase(),E=m?.examples?.[a]||m?.formExamples?.[a],se={...m?.formExamples||{},...m?.examples||{}},[x]=Object.values(se),U=E?.serverValues?.[p]?.value||x?.serverValues?.[p]?.value,D=t=>!t||typeof t!="object"||!m?.schema?.rawSchema?null:C(ke(m.schema.rawSchema,t),{...v,format:"xml"},s),T=(()=>{if(S?.body)return S.body;if(z===d.XML){const t=U||E?.value||x?.value;if(typeof t=="string")return t;const l=D(U)||D(E?.value)||D(x?.value);if(l)return l;if(m?.schema)return C(m.schema.rawSchema,{...v,format:"xml"},s)}else{const t=m?.schema&&C(m.schema.rawSchema,{...v,format:"json"},s);return U||E?.value||x?.value||t}return""})();let g="",L=[];switch(fe(z)){case d.JSON:g=JSON.stringify(j(T,u));break;case d.XML:g=T;break;case d.MULTIPART:case d.URL_ENCODED:typeof T=="string"?g=T:(g=I.stringify(j(T,u)),L=B(j(T,u)));break;default:g=String(T||"")}const ne=g?{mimeType:m?.name||d.OCTET_STREAM,text:g,params:L}:void 0,oe=e.responses.map(t=>t.code);return{method:e.httpVerb,url:re,httpVersion:"HTTP/1.1",cookies:G,headers:N,queryString:Z,postData:ne,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:X,basicAuth:K,pathParameters:ae,serverVariables:h,allResponseCodes:oe}}const f={withImports:!0,withComments:!1},A={curl:{code:"shell",defaultTarget:"curl",defaultOptions:{...f,short:!0}},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:{...f,withImports:!1}},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:{...f}},Python:{code:"python",defaultTarget:"requests",defaultOptions:{...f}},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:{...f}},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:{...f}},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:{...f}},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:{...f}},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:{...f}},PHP:{code:"php",defaultTarget:"curl",defaultOptions:{...f}},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:{...f}},R:{code:"r",defaultTarget:"httr",defaultOptions:{...f}}};function Ie({lang:e,operation:a,exampleName:o,pathParams:n,properties:s,options:r={},environment:c,translate:u}){try{const{skipOptionalParameters:i,withOAuth2Call:h,spec:k,generatedPayloadSamplesMaxDepth:_,store:p,activeMimeName:b}=r,w=_e(a,{exampleName:o,pathParams:n,properties:s,skipOptionalParameters:i,withOAuth2Call:h,spec:k,generatedPayloadSamplesMaxDepth:_,activeMimeName:b},{environment:c,requestValues:p.requestValues,activeSecuritySchemeIds:p.activeSecuritySchemeIds}),R=new ye(w);return A[e]?R.convert(A[e].code,A[e].defaultTarget,{...A[e].defaultOptions,...r}):u("openapi.unsupportedLanguage","Language is not supported.")}catch(i){return console.error(i),u("openapi.failedToGenerateCodeSample","Failed to generate code sample.")}}function Te(e,a,o){const n={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},s=o?.server;for(const r of e?.schemes||[]){const c=pe(r.id,o),u=s&&r.serverValues&&r.serverValues[s],i={access_token:u?.["x-defaultAccessToken"]||r["x-defaultAccessToken"],token_type:u?.["x-defaultTokenType"]||r["x-defaultTokenType"],client_id:u?.["x-defaultClientId"]||r["x-defaultClientId"],client_secret:u?.["x-defaultClientSecret"]||r["x-defaultClientSecret"]},h=u?.["x-defaultUsername"]||r["x-defaultUsername"],k=u?.["x-defaultPassword"]||r["x-defaultPassword"],_=u&&"scopes"in u?u.scopes||[]:r.scopes||[];switch(r.type){case"openIdConnect":n.securityHeaders?.push({name:"Authorization",value:i.access_token?`${i.token_type||"Bearer"} ${i.access_token}`:c.token?`${i.token_type||c.token.token_type||"Bearer"} ${c.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const p=i.access_token?`${i.token_type||"Bearer"} ${i.access_token}`:c.token?`${c.token.token_type||"Bearer"} ${c.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";r.flows.deviceAuthorization&&a?n.securityOAuth2ExtraCalls.push(ge(r.flows.deviceAuthorization,_)):r.flows.clientCredentials&&a?n.securityOAuth2ExtraCalls.push(Oe(r.flows.clientCredentials,_,{...c,client_id:i.client_id||c.client_id,client_secret:i.client_secret||c.client_secret})):r.flows.password&&a&&n.securityOAuth2ExtraCalls.push(ve(r.flows.password,_,{...c,client_id:i.client_id||c.client_id,client_secret:i.client_secret||c.client_secret})),n.securityHeaders?.push({name:"Authorization",value:p});break}case"apiKey":{const p=i.access_token||c.raw||"YOUR_API_KEY_HERE";r.in==="header"&&n.securityHeaders?.push({name:r.name,value:p}),r.in==="cookie"&&n.securityCookies.push({name:r.name,value:p}),(r.in==="query"||r.in==="querystring")&&n.securityQueries.push({name:r.name,value:p});break}case"http":if(r.scheme==="basic")n.basicAuth={username:h||c.username||`<${Y.toSnakeCase("Username")}>`,password:k||c.password||`<${Y.toSnakeCase("Password")}>`};else{const p=i?.access_token||c.token?.access_token||`<YOUR_${r.bearerFormat||"TOKEN"}_HERE>`;n.securityHeaders?.push({name:"Authorization",value:`${Ce(r.scheme||"bearer")} ${p}`})}break}}return n}function ge(e,a){const o=e["x-defaultClientId"]??"YOUR_CLIENT_ID",{tokenUrl:n,deviceAuthorizationUrl:s}=e;return{method:"POST",url:s,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:d.URL_ENCODED},{name:"Accept",value:d.JSON}],queryString:[],postData:{mimeType:d.URL_ENCODED,text:"",params:[{name:"client_id",value:o},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"deviceAuthorization",tokenUrl:n,clientId:o}}function ve(e,a,o){const{tokenUrl:n}=e,s=o.client_id??"YOUR_CLIENT_ID";return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:d.URL_ENCODED},{name:"Accept",value:d.JSON}],queryString:[],postData:{mimeType:d.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:s},{name:"client_secret",value:o.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:o.username||"<username>"},{name:"password",value:o.password||"<password>"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"password",tokenUrl:n,clientId:s}}function Oe(e,a,o){const{tokenUrl:n}=e,s=o.client_id??"YOUR_CLIENT_ID";return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:d.URL_ENCODED},{name:"Accept",value:d.JSON}],queryString:[],postData:{mimeType:d.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:s},{name:"client_secret",value:o.client_secret||"YOUR_CLIENT_SECRET"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(V)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[],flowType:"clientCredentials",tokenUrl:n,clientId:s}}function j(e,a){if(e){if(ue(e))return Object.keys(e).length>0&&Object.keys(a).length===0?e:$(e,a,{arrayMerge:J});try{return $(JSON.parse(e),a,{arrayMerge:J})}catch{return!1}}return!1}function B(e,a=""){const o=[];for(const[n,s]of Object.entries(e)){const r=a?`${a}[${n}]`:n;if(typeof s=="object"&&s!==null)o.push(...B(s,r));else{const c=Array.isArray(e)&&typeof s=="string"&&a?a:r;o.push({name:c,value:String(s)})}}return o}function V(e){return e!==void 0}function Ce(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ke(e,a){if(!e||typeof e!="object"||!a||typeof a!="object")return e;const o=JSON.parse(JSON.stringify(e));function n(s,r){if(!(!s||!r||typeof s!="object"||typeof r!="object")&&s.properties){for(const c in s.properties)if(r[c]!==void 0){const u=s.properties[c],i=r[c];if(u.type==="object"&&typeof i=="object"&&!Array.isArray(i))n(u,i);else if(u.type==="array"&&Array.isArray(i)&&i.length>0){const h=i[0];u.items&&u.items.properties&&n(u.items,h)}else u.example=i}}}return n(o,a),o}export{Ce as capitalizeFirst,Ie as getCodeSample,j as getDataRequest,V as isDefined,B as objectToHarParams,C as safeSample};
@@ -1 +1 @@
1
- import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function E(o,s){const e=x(o,s),i=h(e||[],"items");return{contentItems:e,flatItems:i}}export{E as buildContentItems,x as buildMenuStructure};
1
+ import{getTagGroupsItems as c,getTagsItems as g,getTagsWithOperations as p,buildNestedTagsItems as h}from"./tags.js";import{addMarkdownItems as l}from"./markdown.js";import{flattenByProp as T,getValueFromMdParsedExtension as x}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as d}from"../../constants.js";function A(n,o){const{definition:e}=n,{schemaDefinitionsTagName:i}=o,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],s=[...e.tags||[]];if(s.some(t=>t.name===d)||s.push({name:d}),!s.find(t=>t?.name===i)&&i&&s.push({name:i}),e["x-mcp"])for(const t of["Tools","Resources","Prompts"])e["x-mcp"][t]&&(s.find(r=>r?.name===t)||s.push({name:t}));const f=p(n,s),m=e["x-tagGroups"],u=Object.values(f).some(t=>t.parent);return a.push(...l(x(e.info,"description")||"",void 0,1)),u?a.push(...h(n,f,void 0,o)):m&&m.length>0?a.push(...c(n,void 0,m,f,o)):a.push(...g(n,f,void 0,void 0,o)),a}function w(n,o){const e=A(n,o),i=T(e||[],"items");return{contentItems:e,flatItems:i}}export{w as buildContentItems,A as buildMenuStructure};
@@ -1,10 +1,10 @@
1
1
  import type { GroupModel, OperationMenuItem, ContentItemModel } from '../../models/index.js';
2
- import type { TagInfo } from '../types.js';
2
+ import type { TagInfo, TagsInfoMap } from '../types.js';
3
3
  /**
4
4
  * Returns array of Operation items for the tag
5
5
  * @param parent parent OperationsGroup
6
6
  * @param tag tag info returned from `getTagsWithOperations`
7
7
  * @param depth items depth
8
8
  */
9
- export declare function getOperationsItems(parent: GroupModel | undefined, tag: TagInfo, depth: number): OperationMenuItem[];
9
+ export declare function getOperationsItems(parent: GroupModel | undefined, tag: TagInfo, depth: number, tagsMap?: TagsInfoMap): OperationMenuItem[];
10
10
  export declare function getHref({ id }: Pick<ContentItemModel, 'id'>): string;
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as r}from"@redocly/config";import{encodeBackSlashes as d,getOperationId as c,getOperationName as m}from"../../utils/index.js";function l(t,i,a){if(i.operations.length===0)return[];const n=[],p=[];for(const e of i.operations){const o=c(e,t),s={id:o,type:"operation",parent:t,operationDefinition:e,depth:a,name:m(e),httpVerb:e.httpVerb,path:e.pathName,items:[],isAdditionalOperation:e.isAdditionalOperation,isWebhook:e.isWebhook,isRpc:e.isRpc||!!e["x-redocly-openrpc"],operationId:e.operationId,badges:e["x-badges"]||[],href:b({id:o}),deprecated:!!e.deprecated,[r]:e[r]||t?.[r]};e.isWebhook?p.push(s):n.push(s)}return[...n.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated)||Number(e.isAdditionalOperation)-Number(o.isAdditionalOperation)),...p.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated))]}function b({id:t}){return d(`/${t}`.toLowerCase())}export{b as getHref,l as getOperationsItems};
1
+ import{REDOCLY_TEAMS_RBAC as n}from"@redocly/config";import{encodeBackSlashes as h,getOperationId as l,getOperationName as k}from"../../utils/index.js";function I(t,r,f,a){if(r.operations.length===0)return[];const s=[],d=[],p=[];if(a)for(const e of Object.values(a))(e.kind==="badge"||e.kind==="audience")&&p.push(e);for(const e of r.operations){const o=l(e,t),m="operation",c=[...e["x-badges"]||[]];if(e.tags)for(const b of e.tags){const i=p.find(g=>g.name===b);i&&c.push({name:i.summary||i.name,color:i.kind==="audience"?"grey":"blue",position:"after",icon:i.kind==="audience"?"user-group":void 0})}const u={id:o,type:m,parent:t,operationDefinition:e,depth:f,name:k(e),httpVerb:e.httpVerb,path:e.pathName,items:[],isAdditionalOperation:e.isAdditionalOperation,isWebhook:e.isWebhook,isRpc:e.isRpc||!!e["x-redocly-openrpc"],operationId:e.operationId,badges:c,href:N({id:o}),deprecated:!!e.deprecated,[n]:e[n]||t?.[n]};e.isWebhook?d.push(u):s.push(u)}return[...s.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated)||Number(e.isAdditionalOperation)-Number(o.isAdditionalOperation)),...d.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated))]}function N({id:t}){return h(`/${t}`.toLowerCase())}export{N as getHref,I as getOperationsItems};
@@ -26,4 +26,5 @@ export declare function getTagGroupsItems(parser: OpenAPIParser, parent: GroupMo
26
26
  */
27
27
  export declare function getTagsWithOperations(parser: OpenAPIParser, explicitTags: OpenAPITag[]): TagsInfoMap;
28
28
  export declare function processOperation(parser: OpenAPIParser, operationName: string, operationInfo: any, pathName: string, path: any, tags: TagsInfoMap, isWebhook?: boolean, isAdditionalOperation?: boolean): void;
29
+ export declare function buildNestedTagsItems(parser: OpenAPIParser, tagsMap: TagsInfoMap, parent: GroupModel | undefined, options: Options): ContentItemModel[];
29
30
  export declare function capitalize(input: string): string;
@@ -1,4 +1,4 @@
1
- import{getTagOrGroup as l}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as g,GROUP_DEPTH as h}from"../../constants.js";import{getValueFromMdParsedExtension as T,isOperationName as S,JsonPointer as w,safeSlugify as k}from"../../utils/index.js";import{getOperationsItems as x}from"./operation.js";import{addMarkdownItems as y}from"./markdown.js";import{joinWithSeparator as A}from"../history/helpers.js";const O=["tools","resources","prompts"];function R(s,c,e,n,i){let t;if(n===void 0?t=Object.keys(c):t=n.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const a=t.map(o=>c[o]?(c[o].used=!0,c[o]):(console.warn(`Non-existing tag "${o}" is added to the group "${n?.name}"`),null)),r=[];for(const o of a){if(!o)continue;const f=l("tag",o,e);if(f.depth=h+1,o.name===""){const m=[...y(T(o,"description")||"",f,f.depth+1),...x(void 0,o,f.depth+1)];r.push(...m);continue}const p=b({definition:s.definition,tag:o,parent:f,schemaDefinitionsTagName:i.schemaDefinitionsTagName}),d=j(s.definition,o,f);f.items=[...p,...d,...y(T(o,"description")||"",f,f.depth+1),...x(f,o,f.depth+1)],r.push(f)}return r.filter(({name:o,items:f})=>o!==g||f.length>0)}function C(s,c,e,n,i){const t=[];for(const a of e){const r=l("group",a,c);r.depth=h,r.items=R(s,n,r,a,i),t.push(r)}return t}function b({definition:s,tag:c,parent:e,schemaDefinitionsTagName:n}){const i=n?[n]:[];return Object.entries(s.components?.schemas||{}).map(([t,a])=>{if(!(a["x-tags"]||i).includes(c.name))return null;const o=l("schema",{name:t,"x-displayName":`${a.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},e);return o.depth=e.depth+1,o}).filter(Boolean)}function j(s,c,e){const n=[];for(const i of O)if(s["x-mcp"]?.[i]){const t=P(i),a=[t];for(const r of s["x-mcp"]?.[i]||[])if((r.tags?.length?r.tags:a).includes(c.name)){const f=A(e.id,k(r.name)),p=i==="tools"?`Tool name: \`${r.name}\`
1
+ import{getTagOrGroup as u}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as y,GROUP_DEPTH as O,MAX_NESTING_TAGS_LEVEL as _}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as j,JsonPointer as R,safeSlugify as D}from"../../utils/index.js";import{getOperationsItems as g}from"./operation.js";import{addMarkdownItems as T}from"./markdown.js";import{joinWithSeparator as G}from"../history/helpers.js";const S=["tools","resources","prompts"];function C(r,a,o,s,i){let t;if(s===void 0?t=Object.keys(a):t=s.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(e=>a[e]?(a[e].used=!0,a[e]):(console.warn(`Non-existing tag "${e}" is added to the group "${s?.name}"`),null)),c=[];for(const e of f){if(!e)continue;const n=u("tag",e,o);if(n.depth=O+1,e.name===""){const d=[...T(h(e,"description")||"",n,n.depth+1),...g(void 0,e,n.depth+1,a)];c.push(...d);continue}const m=w({definition:r.definition,tag:e,parent:n,schemaDefinitionsTagName:i.schemaDefinitionsTagName}),l=E(r.definition,e,n);n.items=[...m,...l,...T(h(e,"description")||"",n,n.depth+1),...g(n,e,n.depth+1,a)],c.push(n)}return c.filter(({name:e,items:n})=>e!==y||n.length>0)}function H(r,a,o,s,i){const t=[];for(const f of o){const c=u("group",f,a);c.depth=O,c.items=C(r,s,c,f,i),t.push(c)}return t}function w({definition:r,tag:a,parent:o,schemaDefinitionsTagName:s}){const i=s?[s]:[];return Object.entries(r.components?.schemas||{}).map(([t,f])=>{if(!(f?.["x-tags"]||i).includes(a.name))return null;const e=u("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return e.depth=o.depth+1,e}).filter(Boolean)}function E(r,a,o){const s=[];for(const i of S)if(r["x-mcp"]?.[i]){const t=$(i),f=[t];for(const c of r["x-mcp"]?.[i]||[])if((c.tags?.length?c.tags:f).includes(a.name)){const n=G(o.id,D(c.name)),m=i==="tools"?`Tool name: \`${c.name}\`
2
2
 
3
- `:"",m=l(i==="tools"?"tool":i==="resources"?"rsrc":"prompt",{name:r.name,"x-displayName":r.title||r.name,description:`${p}${r.description||""}
4
- {% mcp${t.slice(0,-1)} name="${r.name}" id="${f}" /%}`,isSchema:!0,level:2},e);m.depth=e.depth+1,n.push(m)}}return n}function M(s,c){const{definition:e}=s,n={},i=e["x-webhooks"]||e.webhooks,t=e["x-mcp"];for(const a of c||[])n[a.name]={...a,operations:[]};return e.paths&&u(s,e.paths,n),i&&u(s,i,n,!0),t&&v(t,n),n}function v(s,c){for(const e of O)if(s[e])for(const n of s[e]){const i=n.tags&&n.tags.length?n.tags:[P(e)];for(const t of i){let a=c[t];a===void 0&&(a={name:t,operations:[],used:!0},c[t]=a)}}}function $(s,c,e,n,i,t,a,r){if(i.$ref){const{resolved:f}=s.deref(i);u(s,{[n]:f},t,a);return}let o=e?.tags;(!o||!o.length)&&(o=a?[g]:[""]);for(const f of o){let p=t[f];if(p===void 0&&(p={name:f,operations:[]},t[f]=p),p["x-traitTag"])continue;const d=e.isRpc||!!e["x-redocly-openrpc"]||!!s.definition["x-redocly-openrpc"],m=!!e.responses?.["200"]?.content?.["application/json"];p.operations.push({...e,pathName:n,pointer:w.compile(["paths",n,c]),httpVerb:d?m?"NOTIF":"CALL":c==="x-query"?"query":c,pathParameters:i.parameters||[],pathServers:i.servers,isWebhook:!!a,isRpc:d,isAdditionalOperation:!!r,keywords:e["x-keywords"]})}}function u(s,c,e,n){for(const i of Object.keys(c||{})){const t=c[i],a=Object.keys(t).filter(S);for(const r of a){const o=t[r];$(s,r,o,i,t,e,n)}if(t.additionalOperations)for(const[r,o]of Object.entries(t.additionalOperations))$(s,r,o,i,t,e,n,!0)}}function P(s){return s.charAt(0).toUpperCase()+s.slice(1)}export{P as capitalize,C as getTagGroupsItems,R as getTagsItems,M as getTagsWithOperations,$ as processOperation};
3
+ `:"",d=u(i==="tools"?"tool":i==="resources"?"rsrc":"prompt",{name:c.name,"x-displayName":c.title||c.name,description:`${m}${c.description||""}
4
+ {% mcp${t.slice(0,-1)} name="${c.name}" id="${n}" /%}`,isSchema:!0,level:2},o);d.depth=o.depth+1,s.push(d)}}return s}function W(r,a){const{definition:o}=r,s={},i=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of a||[])s[f.name]={...f,operations:[]};return o.paths&&N(r,o.paths,s),i&&N(r,i,s,!0),t&&U(t,s),s}function U(r,a){for(const o of S)if(r[o])for(const s of r[o]){const i=s.tags&&s.tags.length?s.tags:[$(o)];for(const t of i){let f=a[t];f===void 0&&(f={name:t,operations:[],used:!0},a[t]=f)}}}function P(r,a,o,s,i,t,f,c){if(i.$ref){const{resolved:n}=r.deref(i);N(r,{[s]:n},t,f);return}let e=o?.tags;(!e||!e.length)&&(e=f?[y]:[""]);for(const n of e){let m=t[n];if(m===void 0&&(m={name:n,operations:[]},t[n]=m),m["x-traitTag"])continue;const l=o.isRpc||!!o["x-redocly-openrpc"]||!!r.definition["x-redocly-openrpc"],d=!!o.responses?.["200"]?.content?.["application/json"];m.operations.push({...o,pathName:s,pointer:R.compile(["paths",s,a]),httpVerb:l?d?"NOTIF":"CALL":a==="x-query"?"query":a,pathParameters:i.parameters||[],pathServers:i.servers,isWebhook:!!f,isRpc:l,isAdditionalOperation:!!c,keywords:o["x-keywords"]})}}function N(r,a,o,s){for(const i of Object.keys(a||{})){const t=a[i],f=Object.keys(t).filter(j);for(const c of f){const e=t[c];P(r,c,e,i,t,o,s)}if(t.additionalOperations)for(const[c,e]of Object.entries(t.additionalOperations))P(r,c,e,i,t,o,s,!0)}}function z(r,a,o,s){const i=Object.values(a).filter(e=>{const n=e.kind;return n===void 0||n==="nav"}),t=new Map;i.forEach(e=>{t.set(e.name,e)});const f=i.filter(e=>{const n=e.parent;return!n||!t.has(n)}),c=(e,n,m=1)=>{if(m>_)return console.warn("The tags exceed the maximum nesting level."),[];const l=[];for(const d of e){const p=u("tag",d,n);if(p.depth=(n?.depth||O)+1,d.name===""){const x=[...T(h(d,"description")||"",p,p.depth+1),...g(void 0,d,p.depth+1,a)];l.push(...x);continue}const b=i.filter(x=>x.parent===d.name),k=w({definition:r.definition,tag:d,parent:p,schemaDefinitionsTagName:s.schemaDefinitionsTagName}),A=E(r.definition,d,p),v=c(b,p,m+1);p.items=[...k,...A,...T(h(d,"description")||"",p,p.depth+1),...g(p,d,p.depth+1,a),...v],l.push(p)}return l};return c(f,o,1).filter(({name:e,items:n})=>e!==y||n.length>0)}function $(r){return r.charAt(0).toUpperCase()+r.slice(1)}export{z as buildNestedTagsItems,$ as capitalize,H as getTagGroupsItems,C as getTagsItems,W as getTagsWithOperations,P as processOperation};
@@ -102,6 +102,8 @@ export interface OpenAPIXBadges {
102
102
  name: string;
103
103
  color?: string;
104
104
  position?: 'before' | 'after';
105
+ icon?: string;
106
+ description?: string;
105
107
  }
106
108
  export interface OpenAPIOperation extends ParsedDescriptionWithSummary {
107
109
  tags?: string[];
@@ -155,11 +157,15 @@ export interface OpenAPIExample extends ParsedDescriptionWithSummary {
155
157
  serializedValue?: string;
156
158
  externalValue?: string;
157
159
  }
160
+ export type XMLNodeType = 'element' | 'attribute' | 'text' | 'cdata' | 'none';
158
161
  export interface XMLObject {
162
+ nodeType?: XMLNodeType;
159
163
  name?: string;
160
164
  namespace?: string;
161
165
  prefix?: string;
166
+ /** @deprecated Use nodeType: "attribute" instead */
162
167
  attribute?: boolean;
168
+ /** @deprecated Use nodeType: "element" instead (for wrapped arrays) */
163
169
  wrapped?: boolean;
164
170
  }
165
171
  export interface OpenAPISchema extends ParsedDescription {
@@ -243,7 +249,7 @@ export interface OpenAPIEncoding {
243
249
  explode: boolean;
244
250
  allowReserved: boolean;
245
251
  }
246
- export type OpenAPIParameterLocation = 'query' | 'header' | 'path' | 'cookie';
252
+ export type OpenAPIParameterLocation = 'query' | 'header' | 'path' | 'cookie' | 'querystring';
247
253
  export type OpenAPIParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
248
254
  export interface OpenAPIRequestBody extends ParsedDescription {
249
255
  $ref?: string;
@@ -331,7 +337,7 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
331
337
  type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
332
338
  description?: string;
333
339
  name?: string;
334
- in?: 'query' | 'header' | 'cookie';
340
+ in?: 'query' | 'header' | 'cookie' | 'querystring';
335
341
  scheme?: string;
336
342
  bearerFormat: string;
337
343
  'x-defaultClientId'?: string;
@@ -377,7 +383,10 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
377
383
  export interface OpenAPITag extends ParsedDescription {
378
384
  name: string;
379
385
  description?: string;
386
+ summary?: string;
380
387
  externalDocs?: OpenAPIExternalDocumentation;
388
+ parent?: string;
389
+ kind?: 'badge' | 'audience' | 'nav';
381
390
  'x-displayName'?: string;
382
391
  'x-rbac'?: Record<string, unknown>;
383
392
  'x-keywords'?: unknown;
@@ -0,0 +1,6 @@
1
+ type Breadcrumb = {
2
+ name: string;
3
+ href: string;
4
+ };
5
+ export declare function calculateMaxLength(breadcrumbs: Breadcrumb[], availableWidth: number, isCollapsed: boolean, measureEl: HTMLElement): number;
6
+ export {};
@@ -0,0 +1 @@
1
+ import{trimText as s}from"@redocly/theme/core/openapi";const e=10,m=40;function T(n,l,c,o){if(!n.length||l<=0)return e;const x=Math.max(0,l-(c?m:0));o.textContent="/";const r=o.scrollWidth,W=(n.length-1)*r,d=Math.max(...n.map(t=>t.name.length),e);let h=e,i=d,a=e;for(;h<=i;){const t=Math.floor((h+i)/2);n.reduce((f,g)=>(o.textContent=s(g.name,t),f+o.scrollWidth),0)+W<=x?(a=t,h=t+1):i=t-1}return a}export{T as calculateMaxLength};
@@ -0,0 +1,7 @@
1
+ import type { GroupModel } from '../models/index.js';
2
+ type Breadcrumb = {
3
+ name: string;
4
+ href: string;
5
+ };
6
+ export declare function getBreadcrumbs(tag: GroupModel): Breadcrumb[];
7
+ export {};
@@ -0,0 +1 @@
1
+ function n(r){if(r.type!=="tag")return[];const t=[];let e=r.parent;for(;e&&e.type==="tag";)t.unshift({name:e.name,href:e.href}),e=e.parent;return t}export{n as getBreadcrumbs};
@@ -20,5 +20,7 @@ export * from './isMobile.js';
20
20
  export * from './replaceVariables.js';
21
21
  export * from './areArraysEqual.js';
22
22
  export * from './hasNestedFields.js';
23
+ export * from './getBreadcrumbs.js';
24
+ export * from './calculateMaxLength.js';
23
25
  export * from './configure-helpers.js';
24
26
  export * from './telemetry.js';
@@ -1 +1 @@
1
- export*from"./JsonPointer.js";export*from"./openapi.js";export*from"./helpers.js";export*from"./dom.js";export*from"./debug.js";export*from"./sort.js";export*from"./argValuesHelpers.js";export*from"./theme-helpers.js";export*from"./debounce.js";export*from"./security-details.js";export*from"./session-storage.js";export*from"./local-storage.js";export*from"./parameters.js";export*from"./string.js";export*from"./compose.js";export*from"./saveTextBeforeHeading.js";export*from"./path.js";export*from"./queryString.js";export*from"./isMobile.js";export*from"./replaceVariables.js";export*from"./areArraysEqual.js";export*from"./hasNestedFields.js";export*from"./configure-helpers.js";export*from"./telemetry.js";
1
+ export*from"./JsonPointer.js";export*from"./openapi.js";export*from"./helpers.js";export*from"./dom.js";export*from"./debug.js";export*from"./sort.js";export*from"./argValuesHelpers.js";export*from"./theme-helpers.js";export*from"./debounce.js";export*from"./security-details.js";export*from"./session-storage.js";export*from"./local-storage.js";export*from"./parameters.js";export*from"./string.js";export*from"./compose.js";export*from"./saveTextBeforeHeading.js";export*from"./path.js";export*from"./queryString.js";export*from"./isMobile.js";export*from"./replaceVariables.js";export*from"./areArraysEqual.js";export*from"./hasNestedFields.js";export*from"./getBreadcrumbs.js";export*from"./calculateMaxLength.js";export*from"./configure-helpers.js";export*from"./telemetry.js";
@@ -18,6 +18,7 @@ export declare function urlFormEncodePayload(payload: GenericObject, encoding?:
18
18
  }): string;
19
19
  export declare function serializeQueryParameter(name: string, style: OpenAPIParameterStyle | undefined, explode: boolean, value: unknown): string;
20
20
  export declare function serializeParameterValueWithMime(value: unknown, mime: string): string;
21
+ export declare function serializeQueryStringParameterValueWithMime(value: unknown, mime: string, name: string): string;
21
22
  export declare function serializeParameterValue(parameter: FieldModel, value: unknown): string;
22
23
  export declare function langFromMime(contentType: string): string;
23
24
  export declare function isNamedDefinition(pointer?: string): boolean;
@@ -1 +1 @@
1
- import{dirname as g}from"path";import l from"url-template";import{deleteEmptyArrayItem as w,isArrayOfObjects as E,isNumeric as S,removeQueryStringAndHash as T,resolveUrl as N,sanitizeItemId as m,normalizeText as b,getValueFromMdParsedExtension as j,isAbsoluteUrl as z}from"./helpers.js";import{DEFAULT_TAG_SLUG as D,MediaTypes as a}from"../constants.js";import{JsonPointer as _}from"./JsonPointer.js";import{joinWithSeparator as $}from"../services/index.js";import{tryDecodeURIComponent as R}from"./string.js";import{getUrlDirname as q}from"./url.js";import{IS_BROWSER as L}from"./dom.js";function P(e){return typeof e=="string"&&/\dxx/i.test(e)}function ie(e){return e==="default"||S(e)||P(e)}function oe(e,r=!1,t=!1){if(e==="default")return r?"error":"success";if(t)return e==="200"?"success":"error";let n=typeof e=="string"?parseInt(e,10):e;if(P(e)&&(n*=100),n<100||n>599)throw new Error("invalid HTTP code");let i="success";return n>=300&&n<400?i="redirect":n>=400?i="error":n<200&&(i="info"),i}const U={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0,"x-query":!0,query:!0};function ue(e){return e in U}function se(e){const{operationId:r,pathName:t}=e,n=b(j(e,"description"));return b(j(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function ae(e,r){return r?.id?$(r.id,m(e.operationId?e.operationId:d(e.pointer))).toLowerCase():e.tags?.length?m(e.operationId?e.operationId:d(e.pointer)):m(e.operationId?$(D,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const A={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};function ce(e){if(e.type!==void 0&&!Array.isArray(e.type))return e.type;const r=Object.keys(A);for(const t of r){const n=A[t];if(e[t]!==void 0)return n}return"any"}function F(e,r=e.type){if(e["x-circular-ref"]||e["x-complex"])return!0;if(e.oneOf!==void 0||e.anyOf!==void 0||e.if&&e.then||e.if&&e.else)return!1;let t=!0;const n=Array.isArray(r);return(r==="object"||n&&r?.includes("object"))&&(t=e.properties!==void 0?Object.keys(e.properties).length===0:e.additionalProperties===void 0&&e.unevaluatedProperties===void 0&&e.patternProperties===void 0),Array.isArray(e.items)||Array.isArray(e.prefixItems)?!1:(e.items!==void 0&&typeof e.items!="boolean"&&(r==="array"||n&&r?.includes("array"))&&(t=F(e.items,e.items.type)),t)}function k(e){return e.search(/json/i)!==-1}function pe(e){return e?.search(/xml/i)!==-1}function fe(e){return e===a.URL_ENCODED}function le(e){return e===a.MULTIPART}function me(e){return[a.JSONL,a.NDJSON,a.JSON_SEQ,a.EVENT_STREAM,a.MULTIPART_MIXED].includes(e)}function p(e,r,t){return Array.isArray(e)?e.map(n=>n.toString()).join(t):typeof e=="object"?Object.keys(e).map(n=>`${n}${t}${e[n]}`).join(t):r+"="+e.toString()}function O(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):typeof e=="object"?Object.keys(e).map(t=>e[t]?`${r}[${t}]=${e[t]}`:void 0).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function c(e,r,t){const n="__redoc_param_name__",i=r?"*":"";return l.parse(`{?${n}${i}}`).expand({[n]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function I(e,r){const t=e?"*":"",n="__redoc_param_name__",i=l.parse(`{${n}${t}}`);return R(i.expand({[n]:r}))}function de(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map(t=>{const n=e[t],{style:i="form",explode:o=!0}=r[t]||{};switch(i){case"form":return c(t,o,n);case"spaceDelimited":return p(n,t,"%20");case"pipeDelimited":return p(n,t,"|");case"deepObject":return O(n,t);default:return console.warn("Incorrect or unsupported encoding style: "+i),""}}).join("&")}function W(e,r,t,n){const i=t?"*":"";let o="";r==="label"?o=".":r==="matrix"&&(o=";");const s="__redoc_param_name__";return l.parse(`{${o}${s}${i}}`).expand({[s]:n}).replace(/__redoc_param_name__/g,e)}function H(e,r,t,n){const i=o=>{switch(r){case"form":return c(e,t,o);case"spaceDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style spaceDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"%20");case"pipeDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style pipeDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"|");case"deepObject":return!t||Array.isArray(o)||typeof o!="object"?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):O(o,e);case"simple":return I(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return E(n)&&(n=w(n).map(o=>i(o))),i(n)}function C(e,r,t){switch(e){case"simple":return I(r,t);default:return console.warn("Unexpected style for header: "+e),""}}function J(e,r,t,n){switch(r){case"form":return c(e,t,n);default:return console.warn("Unexpected style for cookie: "+r),""}}function M(e,r){return k(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}function xe(e,r){const{name:t,style:n,explode:i=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return M(r,o);case"cookie":case"query":return`${t}=${M(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!n)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return W(t,n,i,r);case"query":return H(t,n,i,r);case"header":return C(n,i,r);case"cookie":return J(t,n,i,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function ye(e){return e.search(/xml/i)!==-1?"xml":e.includes("application/json-seq")?"json-seq":e.includes("application/jsonl")?"jsonl":e.includes("json")?"json":e.includes("multipart/mixed")?"multipart-mixed":e.includes("text/event-stream")?"yaml":"clike"}const h=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function ge(e){return h.test(e||"")}function be(e){return e?.match(h)?.pop()}function B(e){if(e===void 0)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function x(e,r,t){let n;return r!==void 0&&t!==void 0?r===t?n=`= ${r} ${e}`:n=`[ ${r} .. ${t} ] ${e}`:t!==void 0?n=`<= ${t} ${e}`:r!==void 0&&(r===1?n="non-empty":n=`>= ${r} ${e}`),n}function G(e){const r=typeof e.exclusiveMinimum=="number"?Math.min(e.exclusiveMinimum,e.minimum??1/0):e.minimum,t=typeof e.exclusiveMaximum=="number"?Math.max(e.exclusiveMaximum,e.maximum??-1/0):e.maximum,n=typeof e.exclusiveMinimum=="number"||e.exclusiveMinimum,i=typeof e.exclusiveMaximum=="number"||e.exclusiveMaximum;if(r!==void 0&&t!==void 0)return`${n?"( ":"[ "}${r} .. ${t}${i?" )":" ]"}`;if(t!==void 0)return`${i?"< ":"<= "}${t}`;if(r!==void 0)return`${n?"> ":">= "}${r}`}function je(e){const r=[],t=x("characters",e.minLength,e.maxLength);t!==void 0&&r.push(t);const n=x("items",e.minItems,e.maxItems);n!==void 0&&r.push(n);const i=x(e.minProperties===1&&e.maxProperties===1?"property":"properties",e.minProperties,e.maxProperties);i!==void 0&&r.push(i);const o=B(e.multipleOf);o!==void 0&&r.push(o);const s=G(e);return s!==void 0&&r.push(s),e.uniqueItems&&r.push("unique"),r}function _e(e,r=[]){const t=[],n=[],i=[];return e.forEach(o=>{o.required?r.includes(o.name)?n.push(o):i.push(o):t.push(o)}),n.sort((o,s)=>r.indexOf(o.name)-r.indexOf(s.name)),[...n,...i,...t]}function $e(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function Pe(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};if(!Array.isArray(t))return[];t.forEach(u=>{({resolved:u}=e.deref(u)),o[u.name+"_"+u.in]=!0});const s=r.map((u,f)=>({paramOrRef:u,pointer:_.join(n,["parameters",String(f)])})).filter(({paramOrRef:u})=>({resolved:u}=e.deref(u),!o[u.name+"_"+u.in])),y=t.map((u,f)=>({paramOrRef:u,pointer:_.join(i,["parameters",String(f)])}));return[...s,...y]}function Ae(e,r){const n=e===void 0?T((()=>{if(!L)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?g(i):i})()):z(e)?q(e):g(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?N(n,i.url):i.url,description:i.description||""}))}const Oe=e=>({delete:"del",options:"opts"})[e]||e;function Q(e){return e in{"x-circular-ref":!0,"x-complex":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-badges":!0,"x-hideReplay":!0,"x-feedback":!0,"x-assertionType":!0,"x-rbac":!0}||e.startsWith("x-parsed-md-")}function Ie(e,r){return Object.keys(e).filter(t=>r===!0?t.startsWith("x-")&&!Q(t):t.startsWith("x-")&&r.indexOf(t)>-1).reduce((t,n)=>(t[n]=e[n],t),{})}function Me(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function he(e,r){const{resolved:t}=e.deref(r.content);return X({...r,content:t})}function X(e){let r=e.content;const t=e["x-examples"],n=e["x-example"];if(t){r={...r};for(const i of Object.keys(t)){const o=t[i];r[i]={...r[i],examples:o}}}else if(n){r={...r};for(const i of Object.keys(n)){const o=n[i];r[i]={...r[i],example:o}}}return r}export{ce as detectType,Ie as extractExtensions,he as getContent,X as getContentWithLegacyExamples,be as getDefinitionName,ae as getOperationId,se as getOperationName,oe as getStatusCodeType,je as humanizeConstraints,G as humanizeNumberRange,fe as isFormUrlEncoded,k as isJsonLike,le as isMultipartFormData,ge as isNamedDefinition,ue as isOperationName,F as isPrimitiveType,Q as isRedocExtension,me as isSequentialMediaType,ie as isStatusCode,pe as isXmlLike,ye as langFromMime,Pe as mergeParams,Ae as normalizeServers,Me as pluralizeType,xe as serializeParameterValue,M as serializeParameterValueWithMime,H as serializeQueryParameter,Oe as shortenHTTPVerb,$e as sortByDeprecated,_e as sortByRequired,de as urlFormEncodePayload};
1
+ import{dirname as b}from"path";import m from"url-template";import{deleteEmptyArrayItem as S,isArrayOfObjects as w,isNumeric as E,removeQueryStringAndHash as T,resolveUrl as N,sanitizeItemId as l,normalizeText as j,getValueFromMdParsedExtension as $,isAbsoluteUrl as z}from"./helpers.js";import{DEFAULT_TAG_SLUG as D,MediaTypes as a}from"../constants.js";import{JsonPointer as _}from"./JsonPointer.js";import{joinWithSeparator as P,objectToHarParams as R}from"../services/index.js";import{tryDecodeURIComponent as q}from"./string.js";import{getUrlDirname as U}from"./url.js";import{IS_BROWSER as L}from"./dom.js";function A(e){return typeof e=="string"&&/\dxx/i.test(e)}function se(e){return e==="default"||E(e)||A(e)}function ae(e,r=!1,t=!1){if(e==="default")return r?"error":"success";if(t)return e==="200"?"success":"error";let n=typeof e=="string"?parseInt(e,10):e;if(A(e)&&(n*=100),n<100||n>599)throw new Error("invalid HTTP code");let i="success";return n>=300&&n<400?i="redirect":n>=400?i="error":n<200&&(i="info"),i}const F={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0,"x-query":!0,query:!0};function ce(e){return e in F}function pe(e){const{operationId:r,pathName:t}=e,n=j($(e,"description"));return j($(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function fe(e,r){return r?.id?P(r.id,l(e.operationId?e.operationId:d(e.pointer))).toLowerCase():e.tags?.length?l(e.operationId?e.operationId:d(e.pointer)):l(e.operationId?P(D,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const I={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};function me(e){if(e.type!==void 0&&!Array.isArray(e.type))return e.type;const r=Object.keys(I);for(const t of r){const n=I[t];if(e[t]!==void 0)return n}return"any"}function k(e,r=e.type){if(e["x-circular-ref"]||e["x-complex"])return!0;if(e.oneOf!==void 0||e.anyOf!==void 0||e.if&&e.then||e.if&&e.else)return!1;let t=!0;const n=Array.isArray(r);return(r==="object"||n&&r?.includes("object"))&&(t=e.properties!==void 0?Object.keys(e.properties).length===0:e.additionalProperties===void 0&&e.unevaluatedProperties===void 0&&e.patternProperties===void 0),Array.isArray(e.items)||Array.isArray(e.prefixItems)?!1:(e.items!==void 0&&typeof e.items!="boolean"&&(r==="array"||n&&r?.includes("array"))&&(t=k(e.items,e.items.type)),t)}function W(e){return e.search(/json/i)!==-1}function le(e){return e?.search(/xml/i)!==-1}function C(e){return e===a.URL_ENCODED}function de(e){return e===a.MULTIPART}function xe(e){return[a.JSONL,a.NDJSON,a.JSON_SEQ,a.EVENT_STREAM,a.MULTIPART_MIXED].includes(e)}function p(e,r,t){return Array.isArray(e)?e.map(n=>n.toString()).join(t):typeof e=="object"?Object.keys(e).map(n=>`${n}${t}${e[n]}`).join(t):r+"="+e.toString()}function O(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):typeof e=="object"?Object.keys(e).map(t=>e[t]?`${r}[${t}]=${e[t]}`:void 0).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function c(e,r,t){const n="__redoc_param_name__",i=r?"*":"";return m.parse(`{?${n}${i}}`).expand({[n]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function M(e,r){const t=e?"*":"",n="__redoc_param_name__",i=m.parse(`{${n}${t}}`);return q(i.expand({[n]:r}))}function ye(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map(t=>{const n=e[t],{style:i="form",explode:o=!0}=r[t]||{};switch(i){case"form":return c(t,o,n);case"spaceDelimited":return p(n,t,"%20");case"pipeDelimited":return p(n,t,"|");case"deepObject":return O(n,t);default:return console.warn("Incorrect or unsupported encoding style: "+i),""}}).join("&")}function H(e,r,t,n){const i=t?"*":"";let o="";r==="label"?o=".":r==="matrix"&&(o=";");const s="__redoc_param_name__";return m.parse(`{${o}${s}${i}}`).expand({[s]:n}).replace(/__redoc_param_name__/g,e)}function J(e,r,t,n){const i=o=>{switch(r){case"form":return c(e,t,o);case"spaceDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style spaceDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"%20");case"pipeDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style pipeDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"|");case"deepObject":return!t||Array.isArray(o)||typeof o!="object"?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):O(o,e);case"simple":return M(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return w(n)&&(n=S(n).map(o=>i(o))),i(n)}function B(e,r,t){switch(e){case"simple":return M(r,t);default:return console.warn("Unexpected style for header: "+e),""}}function G(e,r,t,n){switch(r){case"form":return c(e,t,n);default:return console.warn("Unexpected style for cookie: "+r),""}}function x(e,r){return W(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}function Q(e,r,t){return C(r)&&typeof e=="object"&&e!==null?R(e).map(n=>`${encodeURIComponent(n.name)}=${encodeURIComponent(n.value||"")}`).join("&"):`${t}=${x(e,r)}`}function ge(e,r){const{name:t,style:n,explode:i=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return x(r,o);case"cookie":case"query":return`${t}=${x(r,o)}`;case"querystring":return Q(r,o,t);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!n)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return H(t,n,i,r);case"query":case"querystring":return J(t,n,i,r);case"header":return B(n,i,r);case"cookie":return G(t,n,i,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function be(e){return e.search(/xml/i)!==-1?"xml":e.includes("application/json-seq")?"json-seq":e.includes("application/jsonl")?"jsonl":e.includes("json")?"json":e.includes("multipart/mixed")?"multipart-mixed":e.includes("text/event-stream")?"yaml":"clike"}const h=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function je(e){return h.test(e||"")}function $e(e){return e?.match(h)?.pop()}function X(e){if(e===void 0)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function y(e,r,t){let n;return r!==void 0&&t!==void 0?r===t?n=`= ${r} ${e}`:n=`[ ${r} .. ${t} ] ${e}`:t!==void 0?n=`<= ${t} ${e}`:r!==void 0&&(r===1?n="non-empty":n=`>= ${r} ${e}`),n}function K(e){const r=typeof e.exclusiveMinimum=="number"?Math.min(e.exclusiveMinimum,e.minimum??1/0):e.minimum,t=typeof e.exclusiveMaximum=="number"?Math.max(e.exclusiveMaximum,e.maximum??-1/0):e.maximum,n=typeof e.exclusiveMinimum=="number"||e.exclusiveMinimum,i=typeof e.exclusiveMaximum=="number"||e.exclusiveMaximum;if(r!==void 0&&t!==void 0)return`${n?"( ":"[ "}${r} .. ${t}${i?" )":" ]"}`;if(t!==void 0)return`${i?"< ":"<= "}${t}`;if(r!==void 0)return`${n?"> ":">= "}${r}`}function _e(e){const r=[],t=y("characters",e.minLength,e.maxLength);t!==void 0&&r.push(t);const n=y("items",e.minItems,e.maxItems);n!==void 0&&r.push(n);const i=y(e.minProperties===1&&e.maxProperties===1?"property":"properties",e.minProperties,e.maxProperties);i!==void 0&&r.push(i);const o=X(e.multipleOf);o!==void 0&&r.push(o);const s=K(e);return s!==void 0&&r.push(s),e.uniqueItems&&r.push("unique"),r}function Pe(e,r=[]){const t=[],n=[],i=[];return e.forEach(o=>{o.required?r.includes(o.name)?n.push(o):i.push(o):t.push(o)}),n.sort((o,s)=>r.indexOf(o.name)-r.indexOf(s.name)),[...n,...i,...t]}function Ae(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function Ie(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};if(!Array.isArray(t))return[];t.forEach(u=>{({resolved:u}=e.deref(u)),o[u.name+"_"+u.in]=!0});const s=r.map((u,f)=>({paramOrRef:u,pointer:_.join(n,["parameters",String(f)])})).filter(({paramOrRef:u})=>({resolved:u}=e.deref(u),!o[u.name+"_"+u.in])),g=t.map((u,f)=>({paramOrRef:u,pointer:_.join(i,["parameters",String(f)])}));return[...s,...g]}function Oe(e,r){const n=e===void 0?T((()=>{if(!L)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?b(i):i})()):z(e)?U(e):b(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?N(n,i.url):i.url,description:i.description||""}))}const Me=e=>({delete:"del",options:"opts"})[e]||e;function Y(e){return e in{"x-circular-ref":!0,"x-complex":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-badges":!0,"x-hideReplay":!0,"x-feedback":!0,"x-assertionType":!0,"x-rbac":!0}||e.startsWith("x-parsed-md-")}function he(e,r){return Object.keys(e).filter(t=>r===!0?t.startsWith("x-")&&!Y(t):t.startsWith("x-")&&r.indexOf(t)>-1).reduce((t,n)=>(t[n]=e[n],t),{})}function Se(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function we(e,r){const{resolved:t}=e.deref(r.content);return Z({...r,content:t})}function Z(e){let r=e.content;const t=e["x-examples"],n=e["x-example"];if(t){r={...r};for(const i of Object.keys(t)){const o=t[i];r[i]={...r[i],examples:o}}}else if(n){r={...r};for(const i of Object.keys(n)){const o=n[i];r[i]={...r[i],example:o}}}return r}export{me as detectType,he as extractExtensions,we as getContent,Z as getContentWithLegacyExamples,$e as getDefinitionName,fe as getOperationId,pe as getOperationName,ae as getStatusCodeType,_e as humanizeConstraints,K as humanizeNumberRange,C as isFormUrlEncoded,W as isJsonLike,de as isMultipartFormData,je as isNamedDefinition,ce as isOperationName,k as isPrimitiveType,Y as isRedocExtension,xe as isSequentialMediaType,se as isStatusCode,le as isXmlLike,be as langFromMime,Ie as mergeParams,Oe as normalizeServers,Se as pluralizeType,ge as serializeParameterValue,x as serializeParameterValueWithMime,J as serializeQueryParameter,Q as serializeQueryStringParameterValueWithMime,Me as shortenHTTPVerb,Ae as sortByDeprecated,Pe as sortByRequired,ye as urlFormEncodePayload};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.18.0-custom.0",
3
+ "version": "3.18.0-custom.1",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -21,15 +21,15 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@markdoc/markdoc": "0.5.2",
24
- "@redocly/openapi-core": "2.17.0",
24
+ "@redocly/openapi-core": "2.19.0",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.7",
27
27
  "fast-deep-equal": "^3.1.3",
28
- "fast-xml-parser": "5.3.4",
28
+ "fast-xml-parser": "5.3.6",
29
29
  "jotai": "^2.12.5",
30
30
  "jotai-family": "^1.0.1",
31
31
  "json-pointer": "^0.6.2",
32
- "openapi-sampler": "1.6.2",
32
+ "openapi-sampler": "1.7.0",
33
33
  "react-router-dom": "^6.30.3",
34
34
  "slugify": "^1.4.4",
35
35
  "stringify-object": "^3.3.0",
@@ -38,8 +38,8 @@
38
38
  "url-template": "^2.0.8",
39
39
  "util": "~0.12.5",
40
40
  "web-vitals": "3.3.1",
41
- "@redocly/replay": "0.21.0-custom.0",
42
- "@redocly/config": "0.43.0-custom.0"
41
+ "@redocly/config": "0.43.0-custom.1",
42
+ "@redocly/replay": "0.21.0-custom.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@shikijs/transformers": "3.21.0",
@@ -72,7 +72,7 @@
72
72
  "url": "~0.11.0",
73
73
  "vite": "7.2.6",
74
74
  "vitest": "4.0.10",
75
- "@redocly/theme": "0.62.0-custom.0"
75
+ "@redocly/theme": "0.62.0-custom.1"
76
76
  },
77
77
  "scripts": {
78
78
  "start": "pnpm run copy-highlight-hook && vite",