@redocly/openapi-docs 3.17.0-next.0 → 3.17.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useAtomValue as i}from"jotai";import{JsonViewer as m}from"@redocly/theme/components/JsonViewer/JsonViewer";import{isFormUrlEncoded as a,isJsonLike as c,langFromMime as d,urlFormEncodePayload as f}from"../../utils/index.js";import{globalOptionsAtom as p}from"../../jotai/store.js";import{StyledCodeBlock as g}from"./styled.js";function y({value:o,mimeType:r,encoding:t,onCopyClick:e,onPanelToggle:l}){const{jsonSamplesExpandLevel:s}=i(p);return c(r)?n(m,{data:o,expandLevel:s,onCopyClick:e,onPanelToggle:l}):(typeof o=="object"&&(a(r)?o=f(o,t):o=JSON.stringify(o,null,2)),n(g,{lang:d(r),source:o,header:{className:"code-block-header",controls:{copy:{onClick:e}}}}))}export{y as ExampleValue};
1
+ import{jsx as n}from"react/jsx-runtime";import{useAtomValue as s}from"jotai";import{JsonViewer as a}from"@redocly/theme/components/JsonViewer/JsonViewer";import{isFormUrlEncoded as m,isJsonLike as c,langFromMime as d,urlFormEncodePayload as f,isSequentialMediaType as p}from"../../utils/index.js";import{globalOptionsAtom as g}from"../../jotai/store.js";import{StyledCodeBlock as x}from"./styled.js";function y({value:o,mimeType:r,encoding:t,onCopyClick:e,onPanelToggle:i}){const{jsonSamplesExpandLevel:l}=s(g);return c(r)&&!p(r)?n(a,{data:o,expandLevel:l,onCopyClick:e,onPanelToggle:i}):(typeof o=="object"&&(m(r)?o=f(o,t):o=JSON.stringify(o,null,2)),n(x,{lang:d(r),source:o,header:{className:"code-block-header",controls:{copy:{onClick:e}}}}))}export{y as ExampleValue};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{memo as b,useCallback as i}from"react";import{useAtomValue as n}from"jotai";import{PayloadSamples as h,StyledCodeBlock as v}from"../PayloadSamples/index.js";import{createCodeSampleCopyEvent as k}from"../../events/index.js";import{globalOptionsAtom as T}from"../../jotai/store.js";import{Summary as g}from"./Summary.js";import{Tabs as x}from"../Tabs/index.js";import{CodeBlockPanel as N}from"../common/index.js";import{useTelemetry as A,useTranslate as E}from"../../hooks/index.js";import{activeMimeNameAtom as M}from"../../jotai/app.js";import{operationStore as P}from"../../jotai/operation.js";function R({operation:o,activeResponseTab:d,onTabChange:f,onPanelToggle:m}){const a=A(),{events:r}=n(T),y=E(),C=o.responses.filter(e=>e.content?.hasSample??!1),s=o.responses.map(({code:e})=>({key:e,title:e})),p=s?.find(({key:e})=>e===d)||s?.[0],l=n(M),{activeExampleName:c}=n(P(o.pointer)),u=i(()=>{a.sendCopyCodeSnippetClickedMessage({snippetType:"response"});const e=k({operation:o,type:"response",activeMimeName:l,activeExampleName:c});r?.codeSamplesCopy?.(e)},[a,o,r,l,c]),S=i(e=>{m?.(e,"response-samples")},[m]);return C.length?t(N,{className:"panel-response-samples",header:()=>t(g,{tabs:t(x,{tabs:s,activeTab:p,onChange:e=>f(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===p.key?t("div",{children:e?.content?.hasSample?t(h,{content:e.content,onCopyClick:u,onPanelToggle:S}):t(v,{source:y("openapi.noResponseContent","No content")})},e.code):null)}):null}const J=b(R);export{J as ResponseSamples};
1
+ import{jsx as t}from"react/jsx-runtime";import{memo as b,useCallback as i}from"react";import{useAtomValue as n}from"jotai";import{PayloadSamples as h,StyledCodeBlock as v}from"../PayloadSamples/index.js";import{createCodeSampleCopyEvent as k}from"../../events/index.js";import{globalOptionsAtom as T}from"../../jotai/store.js";import{Summary as g}from"./Summary.js";import{Tabs as x}from"../Tabs/index.js";import{CodeBlockPanel as N}from"../common/index.js";import{useTelemetry as A,useTranslate as E}from"../../hooks/index.js";import{activeMimeNameAtom as M}from"../../jotai/app.js";import{operationStore as P}from"../../jotai/operation.js";function R({operation:o,activeResponseTab:d,onTabChange:f,onPanelToggle:a}){const m=A(),{events:r}=n(T),y=E(),C=o.responses.filter(e=>e.content?.hasSample??!1),s=o.responses.map(({code:e})=>({key:e,title:e})),p=s?.find(({key:e})=>e===d)||s?.[0],l=n(M),{activeExampleName:c}=n(P(o.pointer)),u=i(()=>{m.sendCopyCodeSnippetClickedMessage({snippetType:"response"});const e=k({operation:o,type:"response",activeMimeName:l,activeExampleName:c});r?.codeSamplesCopy?.(e)},[m,o,r,l,c]),S=i(e=>{a?.(e,"response-samples")},[a]);return C.length?t(N,{className:"panel-response-samples",header:()=>t(g,{tabs:t(x,{tabs:s,activeTab:p,onChange:e=>f(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===p.key?t("div",{"data-testid":"response-payload-sample",children:e?.content?.hasSample?t(h,{content:e.content,onCopyClick:u,onPanelToggle:S}):t(v,{source:y("openapi.noResponseContent","No content")})},e.code):null)}):null}const J=b(R);export{J as ResponseSamples};
@@ -5,9 +5,14 @@ export declare enum WindowReferenceOptions {
5
5
  export declare enum MediaTypes {
6
6
  OCTET_STREAM = "application/octet-stream",
7
7
  MULTIPART = "multipart/form-data",
8
+ MULTIPART_MIXED = "multipart/mixed",
8
9
  URL_ENCODED = "application/x-www-form-urlencoded",
9
10
  JSON = "application/json",
10
- XML = "application/xml"
11
+ XML = "application/xml",
12
+ JSONL = "application/jsonl",
13
+ NDJSON = "application/x-ndjson",
14
+ JSON_SEQ = "application/json-seq",
15
+ EVENT_STREAM = "text/event-stream"
11
16
  }
12
17
  export declare const SECTION_ATTR = "data-section-id";
13
18
  export declare const GROUP_DEPTH = 0;
package/lib/constants.js CHANGED
@@ -1 +1 @@
1
- var o;(function(t){t.ON_DEEP_LINK_CLICK="onDeepLinkClick",t.HOOKS="hooks"})(o||(o={}));var E;(function(t){t.OCTET_STREAM="application/octet-stream",t.MULTIPART="multipart/form-data",t.URL_ENCODED="application/x-www-form-urlencoded",t.JSON="application/json",t.XML="application/xml"})(E||(E={}));const e="data-section-id",r=0,p="other",a="webhooks",_={NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED"},n=["title"],D=100,L=150,c=["text","title","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"];export{p as DEFAULT_TAG_SLUG,a as DEFAULT_WEBHOOKS_TAG_NAME,n as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,r as GROUP_DEPTH,L as HIGHLIGHTED_TEXT_MAX_LENGTH,_ as LOADING_STATE,E as MediaTypes,c as SEARCH_INDEX_FIELDS,D as SEARCH_LIMIT,e as SECTION_ATTR,o as WindowReferenceOptions};
1
+ var o;(function(t){t.ON_DEEP_LINK_CLICK="onDeepLinkClick",t.HOOKS="hooks"})(o||(o={}));var E;(function(t){t.OCTET_STREAM="application/octet-stream",t.MULTIPART="multipart/form-data",t.MULTIPART_MIXED="multipart/mixed",t.URL_ENCODED="application/x-www-form-urlencoded",t.JSON="application/json",t.XML="application/xml",t.JSONL="application/jsonl",t.NDJSON="application/x-ndjson",t.JSON_SEQ="application/json-seq",t.EVENT_STREAM="text/event-stream"})(E||(E={}));const n="data-section-id",r=0,a="other",p="webhooks",_={NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED"},D=["title"],L=100,c=150,e=["text","title","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"];export{a as DEFAULT_TAG_SLUG,p as DEFAULT_WEBHOOKS_TAG_NAME,D as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,r as GROUP_DEPTH,c as HIGHLIGHTED_TEXT_MAX_LENGTH,_ as LOADING_STATE,E as MediaTypes,e as SEARCH_INDEX_FIELDS,L as SEARCH_LIMIT,n as SECTION_ATTR,o as WindowReferenceOptions};
@@ -1 +1 @@
1
- import{getSchema as E}from"./schema.js";import{isFormUrlEncoded as b,isJsonLike as j,isXmlLike as k,isMultipartFormData as D,JsonPointer as M,mapValues as R}from"../utils/index.js";import{getExamples as r}from"./example.js";import{safeSample as v}from"../services/code-samples/index.js";function P({parser:t,info:{encoding:e,schema:m},schema:l,mime:s,options:{isRequestType:a,onlyRequiredInSamples:p,generatedSamplesMaxDepth:u,format:d="json"}}){const f={skipReadOnly:a,skipWriteOnly:!a,skipNonRequired:a&&p,maxSampleDepth:u,quiet:!0,format:d};let n={};if(l&&l.oneOf)for(const o of l.oneOf){const i=v(o.rawSchema,f,t.definition);i!==null&&(l.discriminatorProp&&typeof i=="object"&&i&&i[l.discriminatorProp]&&!o.isDefaultMapping&&(i[l.discriminatorProp]=o.title),n[o.title]=r({parser:t,infoOrRef:{value:i},mime:s,encoding:e}))}else if(l){const o=v(m,f,t.definition);o!==null?n={default:r({parser:t,infoOrRef:{value:o},mime:s,encoding:e})}:n={default:{value:null,rawValue:"null"}}}else n={default:{value:null,rawValue:"null"}};return n}function L(t,e,m,l,s,{operation:a,type:p,response:u,absolutePointer:d=""}){let f,n,o;const i=l.schema&&E({parser:t,schemaOrRef:l.schema,pointer:"",absolutePointer:M.join(d,["content",e,"schema"]),options:s,deps:{operation:a,type:p,response:u}}),{onlyRequiredInSamples:c,generatedSamplesMaxDepth:x}=s,{encoding:O,examples:S,example:g}=l;return s.unstable_skipSamples||(S!==void 0?f=R(S,h=>r({parser:t,infoOrRef:h,mime:e,encoding:O})):g!==void 0?f={default:r({parser:t,infoOrRef:{value:t.deref(g).resolved},mime:e,encoding:O})}:j(e)||k(e)?(f=P({parser:t,info:l,schema:i,mime:e,options:{isRequestType:m,onlyRequiredInSamples:c,generatedSamplesMaxDepth:x,format:k(e)?"xml":"json"}}),o=i?.pointer):(b(e)||D(e))&&(o=i?.pointer,n=P({parser:t,info:l,schema:i,mime:e,options:{isRequestType:m,onlyRequiredInSamples:c,generatedSamplesMaxDepth:x}}))),{examples:f,schema:i,examplesPointer:o,name:e,isRequestType:m,formExamples:n,onlyRequiredInSamples:c,operation:a}}export{L as getMediaType};
1
+ import{getSchema as M}from"./schema.js";import{isFormUrlEncoded as D,isJsonLike as w,isXmlLike as k,isMultipartFormData as U,isSequentialMediaType as A,JsonPointer as F,mapValues as T}from"../utils/index.js";import{getExamples as d}from"./example.js";import{safeSample as R,convertSampleToString as O}from"../services/code-samples/index.js";function E({parser:t,info:{encoding:l,schema:x,itemSchema:s},schema:o,mime:n,options:{isRequestType:h,onlyRequiredInSamples:P,generatedSamplesMaxDepth:I,format:S="json"}}){const p={skipReadOnly:h,skipWriteOnly:!h,skipNonRequired:h&&P,maxSampleDepth:I,quiet:!0,format:S};let r={};const b=A(n),v=!!s,c=o?.rawSchema?.prefixItems||o?.schema?.prefixItems||Array.isArray(o?.rawSchema?.items),a=s?t.deref(s).resolved:null,y=a&&Array.isArray(a.oneOf)&&a.oneOf.length>0||o&&o.oneOf;if(o&&o.oneOf)if(b&&v&&!c){const i=[];for(const e of o.oneOf){let f=R(e.rawSchema,p,t.definition);f!==null&&(o.discriminatorProp&&typeof f=="object"&&f&&f[o.discriminatorProp]&&!e.isDefaultMapping&&(f[o.discriminatorProp]=e.title),i.push(f))}if(i.length>0){const e=O(i,n,o);r.default=d({parser:t,infoOrRef:{value:e},mime:n,encoding:l})}}else for(const i of o.oneOf){let e=R(i.rawSchema,p,t.definition);e!==null&&(o.discriminatorProp&&typeof e=="object"&&e&&e[o.discriminatorProp]&&!i.isDefaultMapping&&(e[o.discriminatorProp]=i.title),e=O(e,n,i),r[i.title]=d({parser:t,infoOrRef:{value:e},mime:n,encoding:l}))}else if(y&&a&&Array.isArray(a.oneOf))if(b&&v&&!c){const i=[];for(const e of a.oneOf){const f=t.deref(e).resolved;let m=R(f,p,t.definition);m!==null&&i.push(m)}if(i.length>0){const e=O(i,n,o);r.default=d({parser:t,infoOrRef:{value:e},mime:n,encoding:l})}}else for(const i of a.oneOf){const e=t.deref(i).resolved;let f=R(e,p,t.definition);if(f===null)continue;f=O(f,n,o);const m=e.title||(i.$ref?t.deref(i).resolved.title:"")||"variant";r[m]=d({parser:t,infoOrRef:{value:f},mime:n,encoding:l})}else if(o){let e=R(x||s,p,t.definition);e!==null?(e=O(e,n,o,!0),r={default:d({parser:t,infoOrRef:{value:e},mime:n,encoding:l})}):r={default:d({parser:t,infoOrRef:{value:null},mime:n,encoding:l})}}else r={default:d({parser:t,infoOrRef:{value:null},mime:n,encoding:l})};return r}function q(t,l,x,s,o,{operation:n,type:h,response:P,absolutePointer:I=""}){let S,p;const r=s?.itemSchema??s.schema,b=s?.itemSchema?"itemSchema":"schema";let v;const c=r&&M({parser:t,schemaOrRef:r,pointer:"",absolutePointer:F.join(I,["content",l,b]),options:o,deps:{operation:n,type:h,response:P}}),{onlyRequiredInSamples:a,generatedSamplesMaxDepth:y}=o,{encoding:i,examples:e,example:f}=s;if(!o.unstable_skipSamples){const m=u=>typeof u=="string"?u:O(u,l,c);if(e!==void 0)S=T(e,u=>{const g=t.deref(u).resolved.value,j=m(g);return d({parser:t,infoOrRef:{value:j},mime:l,encoding:i})});else if(f!==void 0){const u=t.deref(f).resolved,g=typeof u=="object"&&u!==null&&"value"in u?u.value:u,j=m(g);S={default:d({parser:t,infoOrRef:{value:j},mime:l,encoding:i})}}else w(l)||k(l)||A(l)?(S=E({parser:t,info:s,schema:c,mime:l,options:{isRequestType:x,onlyRequiredInSamples:a,generatedSamplesMaxDepth:y,format:k(l)?"xml":"json"}}),v=c?.pointer):(D(l)||U(l))&&(v=c?.pointer,p=E({parser:t,info:s,schema:c,mime:l,options:{isRequestType:x,onlyRequiredInSamples:a,generatedSamplesMaxDepth:y}}))}return{examples:S,schema:c,examplesPointer:v,name:l,isRequestType:x,formExamples:p,onlyRequiredInSamples:a,operation:n}}export{q as getMediaType};
@@ -247,6 +247,7 @@ export type SchemaModel = {
247
247
  constraints: string[];
248
248
  fields?: FieldModel[];
249
249
  items?: SchemaModel;
250
+ itemSchema?: SchemaModel;
250
251
  oneOf?: SchemaModel[];
251
252
  oneOfType: string;
252
253
  discriminatorProp?: string;
@@ -0,0 +1,2 @@
1
+ import type { SchemaModel } from '../../models/types.js';
2
+ export declare function convertSampleToString(sample: unknown, mime: string, schema?: SchemaModel, repeat?: boolean): unknown;
@@ -0,0 +1,17 @@
1
+ import{MediaTypes as y}from"../../constants.js";const A="boundary-separator",d=n=>typeof n=="object"&&n!==null,$=(n,r)=>r?.contentMediaType?r.contentMediaType:r?.format==="binary"?"application/octet-stream":typeof n=="object"&&n!==null?"application/json":"text/plain",S=n=>{const r=[];if(n.event!==void 0&&r.push(`event: ${n.event}`),n.data!==void 0){const t=n.data;(typeof t=="string"?t:JSON.stringify(t)).split(`
2
+ `).forEach(o=>{r.push(`data: ${o}`)})}return n.id!==void 0&&r.push(`id: ${n.id}`),n.retry!==void 0&&r.push(`retry: ${n.retry}`),r.join(`
3
+ `)},l=(n,r)=>typeof n!="string"||n!=="string"?n:r?.format==="binary"?"[Binary data]":r?.format==="byte"?"[Base64 encoded data]":n,T=(n,r)=>{if(!r?.fields)return n;const t={...n};for(const e of r.fields)t[e.name]!==void 0&&(t[e.name]=l(t[e.name],e.schema));return t},O=(n,r,t)=>{const e=[`Content-Type: ${n}`];return t&&e.push(`Content-Transfer-Encoding: ${t}`),[...e,"",r].join(`\r
4
+ `)},v=(n,r)=>r.map(t=>`--${n}\r
5
+ ${t}`).join(`\r
6
+ `),N=n=>{if(!n||typeof n!="object"||Array.isArray(n))return!1;const r=Object.keys(n);return r.length===0?!1:r.every(t=>/^\d+$/.test(t))},h=n=>Object.keys(n).map(t=>parseInt(t,10)).sort((t,e)=>t-e).map(t=>n[String(t)]),J=(n,r,t)=>{const e=[],o=s=>N(s)?h(s):s,u=(s,a)=>{const c=o(s);if(typeof c=="object"&&c!==null){const p=Array.isArray(c)?c.map(f=>typeof f=="object"&&f!==null?T(f,a):l(f,a)):T(c,a);e.push(O("application/json",JSON.stringify(p,null,2)))}else{const p=l(c,a),f=$(p,a),E=a?.format==="binary"?"binary":a?.format==="byte"?"base64":void 0;e.push(O(f,String(p),E))}},i=o(n);return Array.isArray(i)?i.forEach((s,a)=>u(s,r?.fields?.[a]?.schema)):u(i,r),v(A,e)},M=n=>Array.isArray(n)?n.map(r=>S(r)).join(`
7
+
8
+ `):S(n),_=(n,r)=>{const t="0x1E",e="0x0A";return typeof n=="string"?n:r?.type==="array"?`${t}${[JSON.stringify(n)]}${e}`:Array.isArray(n)&&n.length>=1?n.map(o=>`${t}${JSON.stringify(o)}${e}`).join(`
9
+ `):`${t}${JSON.stringify(n)}${e}`},g=(n,r)=>typeof n=="string"?n:r?.type==="array"?`${[JSON.stringify(n)]}`:Array.isArray(n)?n.map(t=>JSON.stringify(t)).join(`
10
+ `):JSON.stringify(n),C={[y.EVENT_STREAM]:{shouldConvert:d,convert:M,lineSeparator:`
11
+
12
+ `},[y.JSON_SEQ]:{shouldConvert:d,convert:_,lineSeparator:`
13
+ `},[y.JSONL]:{shouldConvert:d,convert:g,lineSeparator:`
14
+ `},[y.NDJSON]:{shouldConvert:d,convert:g,lineSeparator:`
15
+ `},[y.MULTIPART_MIXED]:{shouldConvert:n=>n!==null,convert:J,lineSeparator:`\r
16
+ `}};function m(n,r,t,e=!1){const o=C[r];if(o?.shouldConvert(n)){const u=o.convert(n,t);let i;return e?i=Array.from({length:3},()=>u).join(o.lineSeparator):i=u,r===y.MULTIPART_MIXED&&(i=i+`\r
17
+ --${A}--`),i}return n}export{m as convertSampleToString};
@@ -1,2 +1,3 @@
1
1
  export * from './generator.js';
2
2
  export * from './types.js';
3
+ export * from './convertSampleToString.js';
@@ -1 +1 @@
1
- export*from"./generator.js";export*from"./types.js";
1
+ export*from"./generator.js";export*from"./types.js";export*from"./convertSampleToString.js";
@@ -214,6 +214,7 @@ export interface OpenAPIDiscriminator {
214
214
  }
215
215
  export interface OpenAPIMediaType {
216
216
  schema?: Referenced<OpenAPISchema>;
217
+ itemSchema?: Referenced<OpenAPISchema>;
217
218
  example?: any;
218
219
  examples?: {
219
220
  [name: string]: Referenced<OpenAPIExample>;
@@ -9,4 +9,4 @@ $4`);{const s=r===""||r.endsWith(`
9
9
 
10
10
  `;return`${r}${s}# ${e}
11
11
 
12
- ${t}`}}const W=r=>Array.isArray(r)&&r.some(e=>i(e)),y=r=>r.filter(e=>!!e),C=r=>i(r)&&!Array.isArray(r);function x(r){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(r)}function N(r,e){let t;if(e.startsWith("//"))t=`${u(r,!0)?.protocol||"https:"}${e}`;else if(x(e))t=e;else if(!e.startsWith("/"))t=c(r)+"/"+e;else{const n=u(r);n?(n.pathname=e,t=n.toString()):t=e}return c(t)}function I(r){return r.charAt(0).toUpperCase()+r.slice(1)}function L(r){try{if(!r)return"";const e=new URL(r);return e.search="",e.hash="",e.toString()}catch{return r}}function P(r){return r.replace(/["\\]/g,"\\$&")}function T(r){return r.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(parseInt(t,10))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function j(r){return r&&r.replace(/#/g,"_").toLowerCase()}function z(r,e){return e||a(r)&&f.baseName(r)||""}function M(r={},e,t){return typeof e=="string"&&(e=e.split(".")),e.reduce((n,o)=>n&&n[o]?n[o]:t,r)}function g(r){return(...e)=>e.filter(Boolean).join(r)}const D=g(".");function F(r){return l?window?.REFERENCE_DOCS_OPTIONS?.[r]:null}const _=r=>p(r)?r:r?.raw,H=(r,e)=>{const t=r?.[`x-parsed-md-${e}`]||r?.[e];if(!t)return;if(!r?.[`x-parsed-md-${e}`]&&e!=="x-enumDescriptions")return r?.[e];if(e!=="x-enumDescriptions")return d(r,e);let n={};for(const o in t)o.startsWith("x-parsed-md")||(n[o]=t?.[`x-parsed-md-${o}`]||t?.[o]);return Object.keys(n).length?n:t};function B(r){return r.name||r.description}function d(r,e){const t=r?.[`x-parsed-md-${e}`]||r?.[e];return t?.raw?t:{result:t?.result||r?.[e]?.result||r?.[e],raw:r?.[e]}}function U(r,e){return e===r.length-1}function V(r,e){const t=Object.keys(r);return t.indexOf(e)===t.length-1}export{E as appendToMdHeading,y as deleteEmptyArrayItem,D as dottedString,P as escapeHTMLAttrChars,R as flattenByProp,M as get,B as getServerDisplayName,H as getValueFromMdParsedExtension,F as getWindowReferenceOptions,x as isAbsoluteUrl,W as isArrayOfObjects,U as isLastInArray,V as isLastProperty,C as isMergeableObject,b as isNumeric,g as joinStringFactory,A as mapValues,w as mapWithLast,_ as normalizeText,L as removeQueryStringAndHash,N as resolveUrl,j as sanitizeItemId,c as stripTrailingSlash,I as titleize,T as unescapeHTMLChars,z as useSchemaTitle};
12
+ ${t}`}}const W=r=>Array.isArray(r)&&r.some(e=>i(e)),y=r=>r.filter(e=>!!e),C=r=>i(r)&&!Array.isArray(r);function x(r){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(r)}function N(r,e){let t;if(e.startsWith("//"))t=`${u(r,!0)?.protocol||"https:"}${e}`;else if(x(e))t=e;else if(!e.startsWith("/"))t=c(r)+"/"+e;else{const n=u(r);n?(n.pathname=e,t=n.toString()):t=e}return c(t)}function I(r){return r.charAt(0).toUpperCase()+r.slice(1)}function L(r){try{if(!r)return"";const e=new URL(r);return e.search="",e.hash="",e.toString()}catch{return r}}function P(r){return r.replace(/["\\]/g,"\\$&")}function T(r){return r.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(parseInt(t,10))).replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function j(r){return r&&r.replace(/#/g,"_").toLowerCase()}function z(r,e){return e||a(r)&&f.baseName(r)||""}function M(r={},e,t){return typeof e=="string"&&(e=e.split(".")),e.reduce((n,o)=>n&&n[o]?n[o]:t,r)}function g(r){return(...e)=>e.filter(Boolean).join(r)}const D=g(".");function F(r){return l?window?.REFERENCE_DOCS_OPTIONS?.[r]:null}const _=r=>p(r)?r:r?.raw,H=(r,e)=>{const t=r?.[`x-parsed-md-${e}`]||r?.[e];if(!t)return;if(!r?.[`x-parsed-md-${e}`]&&e!=="x-enumDescriptions")return r?.[e];if(e!=="x-enumDescriptions")return d(r,e);let n={};for(const o in t)o.startsWith("x-parsed-md")||(n[o]=t?.[`x-parsed-md-${o}`]||t?.[o]);return Object.keys(n).length?n:t};function B(r){return r.name||r.description}function d(r,e){const t=r?.[`x-parsed-md-${e}`]||r?.[e];return t?.raw?t:{result:t?.result||r?.[e]?.result||r?.[e],raw:r?.[e]}}function U(r,e){return e===r.length-1}function V(r,e){const t=Object.keys(r);return t.indexOf(e)===t.length-1}export{E as appendToMdHeading,y as deleteEmptyArrayItem,D as dottedString,P as escapeHTMLAttrChars,R as flattenByProp,M as get,B as getServerDisplayName,H as getValueFromMdParsedExtension,F as getWindowReferenceOptions,x as isAbsoluteUrl,W as isArrayOfObjects,U as isLastInArray,V as isLastProperty,C as isMergeableObject,b as isNumeric,g as joinStringFactory,A as mapValues,w as mapWithLast,_ as normalizeText,L as removeQueryStringAndHash,N as resolveUrl,j as sanitizeItemId,c as stripTrailingSlash,I as titleize,T as unescapeHTMLChars,z as useSchemaTitle};
@@ -12,6 +12,7 @@ export declare function isJsonLike(contentType: string): boolean;
12
12
  export declare function isXmlLike(contentType: string): boolean;
13
13
  export declare function isFormUrlEncoded(contentType: string): boolean;
14
14
  export declare function isMultipartFormData(contentType: string): boolean;
15
+ export declare function isSequentialMediaType(contentType: string): boolean;
15
16
  export declare function urlFormEncodePayload(payload: GenericObject, encoding?: {
16
17
  [field: string]: OpenAPIEncoding;
17
18
  }): string;
@@ -1 +1 @@
1
- import{dirname as y}from"path";import f from"url-template";import{deleteEmptyArrayItem as M,isArrayOfObjects as E,isNumeric as T,removeQueryStringAndHash as S,resolveUrl as z,sanitizeItemId as m,normalizeText as b,getValueFromMdParsedExtension as g,isAbsoluteUrl as D}from"./helpers.js";import{DEFAULT_TAG_SLUG as N,MediaTypes as j}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 F}from"./url.js";import{IS_BROWSER as U}from"./dom.js";function P(e){return typeof e=="string"&&/\dxx/i.test(e)}function ne(e){return e==="default"||T(e)||P(e)}function ie(e,r=!1){if(e==="default")return r?"error":"success";let t=typeof e=="string"?parseInt(e,10):e;if(P(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let n="success";return t>=300&&t<400?n="redirect":t>=400?n="error":t<200&&(n="info"),n}const L={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};function oe(e){return e in L}function ue(e){const{operationId:r,pathName:t}=e,n=b(g(e,"description"));return b(g(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function se(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?_(N,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const h={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 ae(e){if(e.type!==void 0&&!Array.isArray(e.type))return e.type;const r=Object.keys(h);for(const t of r){const n=h[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 q(e){return e.search(/json/i)!==-1}function ce(e){return e?.search(/xml/i)!==-1}function pe(e){return e===j.URL_ENCODED}function fe(e){return e===j.MULTIPART}function c(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 w(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 a(e,r,t){const n="__redoc_param_name__",i=r?"*":"";return f.parse(`{?${n}${i}}`).expand({[n]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function O(e,r){const t=e?"*":"",n="__redoc_param_name__",i=f.parse(`{${n}${t}}`);return R(i.expand({[n]:r}))}function me(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 a(t,o,n);case"spaceDelimited":return c(n,t,"%20");case"pipeDelimited":return c(n,t,"|");case"deepObject":return w(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 f.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 a(e,t,o);case"spaceDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style spaceDelimited is applicable to arrays or objects"),""):t?a(e,t,o):c(n,e,"%20");case"pipeDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style pipeDelimited is applicable to arrays or objects"),""):t?a(e,t,o):c(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"),""):w(o,e);case"simple":return O(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return E(n)&&(n=M(n).map(o=>i(o))),i(n)}function C(e,r,t){switch(e){case"simple":return O(r,t);default:return console.warn("Unexpected style for header: "+e),""}}function B(e,r,t,n){switch(r){case"form":return a(e,t,n);default:return console.warn("Unexpected style for cookie: "+r),""}}function A(e,r){return q(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}function de(e,r){const{name:t,style:n,explode:i=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return A(r,o);case"cookie":case"query":return`${t}=${A(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 B(t,n,i,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function le(e){return e.search(/xml/i)!==-1?"xml":"clike"}const I=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function xe(e){return I.test(e||"")}function ye(e){return e?.match(I)?.pop()}function G(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 l(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 J(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 be(e){const r=[],t=l("characters",e.minLength,e.maxLength);t!==void 0&&r.push(t);const n=l("items",e.minItems,e.maxItems);n!==void 0&&r.push(n);const i=l(e.minProperties===1&&e.maxProperties===1?"property":"properties",e.minProperties,e.maxProperties);i!==void 0&&r.push(i);const o=G(e.multipleOf);o!==void 0&&r.push(o);const s=J(e);return s!==void 0&&r.push(s),e.uniqueItems&&r.push("unique"),r}function ge(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 je(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function $e(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};t.forEach(u=>{({resolved:u}=e.deref(u)),o[u.name+"_"+u.in]=!0});const s=r.map((u,p)=>({paramOrRef:u,pointer:$.join(n,["parameters",String(p)])})).filter(({paramOrRef:u})=>({resolved:u}=e.deref(u),!o[u.name+"_"+u.in])),x=t.map((u,p)=>({paramOrRef:u,pointer:$.join(i,["parameters",String(p)])}));return[...s,...x]}function _e(e,r){const n=e===void 0?S((()=>{if(!U)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?y(i):i})()):D(e)?F(e):y(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?z(n,i.url):i.url,description:i.description||""}))}const Pe=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 he(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 we(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function Oe(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{ae as detectType,he as extractExtensions,Oe as getContentWithLegacyExamples,ye as getDefinitionName,se as getOperationId,ue as getOperationName,ie as getStatusCodeType,be as humanizeConstraints,J as humanizeNumberRange,pe as isFormUrlEncoded,q as isJsonLike,fe as isMultipartFormData,xe as isNamedDefinition,oe as isOperationName,k as isPrimitiveType,Q as isRedocExtension,ne as isStatusCode,ce as isXmlLike,le as langFromMime,$e as mergeParams,_e as normalizeServers,we as pluralizeType,de as serializeParameterValue,A as serializeParameterValueWithMime,H as serializeQueryParameter,Pe as shortenHTTPVerb,je as sortByDeprecated,ge as sortByRequired,me as urlFormEncodePayload};
1
+ import{dirname as b}from"path";import m from"url-template";import{deleteEmptyArrayItem as w,isArrayOfObjects as E,isNumeric as S,removeQueryStringAndHash as T,resolveUrl as N,sanitizeItemId as l,normalizeText as g,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 L}from"./url.js";import{IS_BROWSER as U}from"./dom.js";function P(e){return typeof e=="string"&&/\dxx/i.test(e)}function ne(e){return e==="default"||S(e)||P(e)}function ie(e,r=!1){if(e==="default")return r?"error":"success";let t=typeof e=="string"?parseInt(e,10):e;if(P(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let n="success";return t>=300&&t<400?n="redirect":t>=400?n="error":t<200&&(n="info"),n}const q={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};function oe(e){return e in q}function ue(e){const{operationId:r,pathName:t}=e,n=g(j(e,"description"));return g(j(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function se(e,r){return r?.id?$(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?$(D,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const O={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 ae(e){if(e.type!==void 0&&!Array.isArray(e.type))return e.type;const r=Object.keys(O);for(const t of r){const n=O[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 ce(e){return e?.search(/xml/i)!==-1}function pe(e){return e===a.URL_ENCODED}function fe(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 A(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 I(e,r){const t=e?"*":"",n="__redoc_param_name__",i=m.parse(`{${n}${t}}`);return R(i.expand({[n]:r}))}function le(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 A(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 m.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"),""):A(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 de(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 xe(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 ye(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 ge(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 je(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 $e(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};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 Pe(e,r){const n=e===void 0?T((()=>{if(!U)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?b(i):i})()):z(e)?L(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 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 Ae(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 Ie(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function Me(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{ae as detectType,Ae as extractExtensions,Me as getContentWithLegacyExamples,be as getDefinitionName,se as getOperationId,ue as getOperationName,ie as getStatusCodeType,ge as humanizeConstraints,G as humanizeNumberRange,pe as isFormUrlEncoded,k as isJsonLike,fe as isMultipartFormData,ye as isNamedDefinition,oe as isOperationName,F as isPrimitiveType,Q as isRedocExtension,me as isSequentialMediaType,ne as isStatusCode,ce as isXmlLike,xe as langFromMime,$e as mergeParams,Pe as normalizeServers,Ie as pluralizeType,de as serializeParameterValue,M as serializeParameterValueWithMime,H as serializeQueryParameter,Oe as shortenHTTPVerb,_e as sortByDeprecated,je as sortByRequired,le as urlFormEncodePayload};
@@ -1 +1 @@
1
- import t from"slugify";function o(e){return e.split("").map(r=>r+"\u0335").join("")}function c(e){return e.replace(/[.[\]]/g,r=>({".":"%2e","[":"%5b","]":"%5d"})[r]||"")}function p(e){return e.replace(/%2e|%5b|%5d/g,r=>({"%2e":".","%5b":"[","%5d":"]"})[r]||"")}function u(e){return e.replace(/\\/g,"%5C")}function a(e){return e.replace(/%/g,"")}function i(e){try{return decodeURIComponent(e)}catch(r){return console.error(`Decoding failed: ${e}`,r),e}}function f(e){return t(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function l(e,r={}){try{return JSON.parse(e)}catch{return r}}export{u as encodeBackSlashes,c as escapeFormId,a as removePercentChart,l as safeJsonParse,f as safeSlugify,o as strikethroughText,i as tryDecodeURIComponent,p as unescapeFormId};
1
+ import t from"slugify";function o(e){return e.split("").map(r=>r+"\u0335").join("")}function c(e){return e.replace(/[.[\]]/g,r=>({".":"%2e","[":"%5b","]":"%5d"})[r]||"")}function p(e){return e.replace(/%2e|%5b|%5d/g,r=>({"%2e":".","%5b":"[","%5d":"]"})[r]||"")}function u(e){return e.replace(/\\/g,"%5C")}function a(e){return e.replace(/%/g,"")}function i(e){try{return decodeURIComponent(e)}catch(r){return console.error("Decoding failed: %s",e,r),e}}function f(e){return t(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function l(e,r={}){try{return JSON.parse(e)}catch{return r}}export{u as encodeBackSlashes,c as escapeFormId,a as removePercentChart,l as safeJsonParse,f as safeSlugify,o as strikethroughText,i as tryDecodeURIComponent,p as unescapeFormId};
package/lib/utils/url.js CHANGED
@@ -1 +1 @@
1
- function s(t,e=!1){let r=t;e&&r.startsWith("//")&&(r="http:"+t);try{return URL?.parse?URL?.parse(r):new URL(r)}catch(n){return console.error(`Invalid URL: ${r}`,n),null}}function o(t){try{const e=new URL(t);let r=e.pathname;if(r.endsWith("/"))return e.origin+r;const n=r.lastIndexOf("/");return n!==-1?(r=r.substring(0,n+1),e.origin+r):e.origin+"/"}catch(e){console.error(`Invalid URL: ${t}`,e);return}}export{o as getUrlDirname,s as urlParse};
1
+ function s(t,e=!1){let r=t;e&&r.startsWith("//")&&(r="http:"+t);try{return URL?.parse?URL?.parse(r):new URL(r)}catch(n){return console.error("Invalid URL: %s",r,n),null}}function o(t){try{const e=new URL(t);let r=e.pathname;if(r.endsWith("/"))return e.origin+r;const n=r.lastIndexOf("/");return n!==-1?(r=r.substring(0,n+1),e.origin+r):e.origin+"/"}catch(e){console.error(`Invalid URL: ${t}`,e);return}}export{o as getUrlDirname,s as urlParse};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.17.0-next.0",
3
+ "version": "3.17.0-next.2",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@markdoc/markdoc": "0.5.2",
24
- "@redocly/openapi-core": "2.12.5",
24
+ "@redocly/openapi-core": "2.13.0",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.7",
27
27
  "fast-deep-equal": "^3.1.3",
@@ -36,8 +36,8 @@
36
36
  "url-template": "^2.0.8",
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
- "@redocly/config": "0.41.0",
40
- "@redocly/replay": "0.20.0-next.0"
39
+ "@redocly/config": "0.41.1",
40
+ "@redocly/replay": "0.20.0-next.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@shikijs/transformers": "1.24.0",
@@ -54,7 +54,7 @@
54
54
  "@vitest/coverage-v8": "^4.0.10",
55
55
  "esbuild": "0.27.0",
56
56
  "jest-styled-components": "7.2.0",
57
- "js-yaml": "4.1.0",
57
+ "js-yaml": "4.1.1",
58
58
  "json-schema": "0.4.0",
59
59
  "outdent": "0.8.0",
60
60
  "path-browserify": "1.0.1",
@@ -70,7 +70,7 @@
70
70
  "url": "~0.11.0",
71
71
  "vite": "7.2.6",
72
72
  "vitest": "4.0.10",
73
- "@redocly/theme": "0.61.0-next.0"
73
+ "@redocly/theme": "0.61.0-next.2"
74
74
  },
75
75
  "scripts": {
76
76
  "start": "npm run copy-highlight-hook && vite",
@@ -82,7 +82,7 @@
82
82
  "prepare:community-dependencies": "npx tsx scripts/prepare-community-dependencies.ts",
83
83
  "apply:community-source": "npx tsx scripts/apply-changes-from-community-source.ts",
84
84
  "test": "npm run prepare:community-source && npm run test:redoc && vitest run",
85
- "test:redoc": "cd redoc && pnpm install && npm run lint && npm run unit",
85
+ "test:redoc": "cd redoc && npm install ../../theme ../../redocly-config --no-save && npm run lint && npm run unit",
86
86
  "unit": "vitest run",
87
87
  "unit:update": "vitest run -u",
88
88
  "unit:watch": "vitest",
@@ -96,8 +96,6 @@
96
96
  "license:check": "npx license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;Apache;CC0-1.0;BSD;BSD-2-Clause;BSD-3-Clause;UNKNOWN' --summary",
97
97
  "precdn:serve": "mkdir -p playground/cdn-test/server-dist && cp -Rf dist/* playground/cdn-test/server-dist && cp -Rf playground/cdn-test/template-source/* playground/cdn-test/server-dist",
98
98
  "cdn-serve": "http-server playground/cdn-test/server-dist",
99
- "copy-highlight-hook": "cp -r ../portal/src/client/app/hooks/codeHighlight ./playground/hooks",
100
- "redoc:use-workspace": "node scripts/use-workspace-deps.js",
101
- "redoc:revert-workspace": "node scripts/use-workspace-deps.js revert"
99
+ "copy-highlight-hook": "cp -r ../portal/src/client/app/hooks/codeHighlight ./playground/hooks"
102
100
  }
103
101
  }