@redocly/openapi-docs 3.19.0-next.0 → 3.19.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.
Files changed (34) hide show
  1. package/dist/redocly-openapi-docs.min.js +2312 -2220
  2. package/lib/components/PayloadSamples/ExampleValue.js +1 -1
  3. package/lib/components/RequestParameters/RequestParameters.js +1 -1
  4. package/lib/components/TagItem/Breadcrumbs.d.ts +11 -0
  5. package/lib/components/TagItem/Breadcrumbs.js +41 -0
  6. package/lib/components/TagItem/OperationNavigationItems.d.ts +4 -2
  7. package/lib/components/TagItem/OperationNavigationItems.js +20 -5
  8. package/lib/components/TagItem/OperationsNavigation.js +27 -2
  9. package/lib/components/TagItem/TagItem.js +17 -16
  10. package/lib/components/common/Badges.js +10 -8
  11. package/lib/components/common/linkify.js +7 -2
  12. package/lib/components/common/panels.js +1 -1
  13. package/lib/constants.d.ts +1 -0
  14. package/lib/constants.js +1 -1
  15. package/lib/models/field.js +1 -1
  16. package/lib/models/group.js +1 -1
  17. package/lib/models/operation.js +1 -1
  18. package/lib/services/code-samples/generator.d.ts +1 -0
  19. package/lib/services/code-samples/generator.js +1 -1
  20. package/lib/services/menu/builder.js +1 -1
  21. package/lib/services/menu/operation.d.ts +2 -2
  22. package/lib/services/menu/operation.js +1 -1
  23. package/lib/services/menu/tags.d.ts +1 -0
  24. package/lib/services/menu/tags.js +3 -3
  25. package/lib/types/open-api.d.ts +11 -2
  26. package/lib/utils/calculateMaxLength.d.ts +6 -0
  27. package/lib/utils/calculateMaxLength.js +1 -0
  28. package/lib/utils/getBreadcrumbs.d.ts +7 -0
  29. package/lib/utils/getBreadcrumbs.js +1 -0
  30. package/lib/utils/index.d.ts +2 -0
  31. package/lib/utils/index.js +1 -1
  32. package/lib/utils/openapi.d.ts +1 -0
  33. package/lib/utils/openapi.js +1 -1
  34. package/package.json +5 -5
@@ -95,6 +95,8 @@ export interface OpenAPIXBadges {
95
95
  name: string;
96
96
  color?: string;
97
97
  position?: 'before' | 'after';
98
+ icon?: string;
99
+ description?: string;
98
100
  }
99
101
  export interface OpenAPIOperation extends ParsedDescriptionWithSummary {
100
102
  tags?: string[];
@@ -148,11 +150,15 @@ export interface OpenAPIExample extends ParsedDescriptionWithSummary {
148
150
  serializedValue?: string;
149
151
  externalValue?: string;
150
152
  }
153
+ export type XMLNodeType = 'element' | 'attribute' | 'text' | 'cdata' | 'none';
151
154
  export interface XMLObject {
155
+ nodeType?: XMLNodeType;
152
156
  name?: string;
153
157
  namespace?: string;
154
158
  prefix?: string;
159
+ /** @deprecated Use nodeType: "attribute" instead */
155
160
  attribute?: boolean;
161
+ /** @deprecated Use nodeType: "element" instead (for wrapped arrays) */
156
162
  wrapped?: boolean;
157
163
  }
158
164
  export interface OpenAPISchema extends ParsedDescription {
@@ -236,7 +242,7 @@ export interface OpenAPIEncoding {
236
242
  explode: boolean;
237
243
  allowReserved: boolean;
238
244
  }
239
- export type OpenAPIParameterLocation = 'query' | 'header' | 'path' | 'cookie';
245
+ export type OpenAPIParameterLocation = 'query' | 'header' | 'path' | 'cookie' | 'querystring';
240
246
  export type OpenAPIParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
241
247
  export interface OpenAPIRequestBody extends ParsedDescription {
242
248
  $ref?: string;
@@ -324,7 +330,7 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
324
330
  type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
325
331
  description?: string;
326
332
  name?: string;
327
- in?: 'query' | 'header' | 'cookie';
333
+ in?: 'query' | 'header' | 'cookie' | 'querystring';
328
334
  scheme?: string;
329
335
  bearerFormat: string;
330
336
  'x-defaultClientId'?: string;
@@ -370,7 +376,10 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
370
376
  export interface OpenAPITag extends ParsedDescription {
371
377
  name: string;
372
378
  description?: string;
379
+ summary?: string;
373
380
  externalDocs?: OpenAPIExternalDocumentation;
381
+ parent?: string;
382
+ kind?: 'badge' | 'audience' | 'nav';
374
383
  'x-displayName'?: string;
375
384
  'x-rbac'?: Record<string, unknown>;
376
385
  '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 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 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){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 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,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 ce(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 pe(e){return e?.search(/xml/i)!==-1}function fe(e){return e===a.URL_ENCODED}function me(e){return e===a.MULTIPART}function le(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 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 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 C(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 H(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 C(t,n,i,r);case"header":return H(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={};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 Oe(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 Ae=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,me as isMultipartFormData,ge as isNamedDefinition,ue as isOperationName,F as isPrimitiveType,Q as isRedocExtension,le as isSequentialMediaType,ie as isStatusCode,pe as isXmlLike,ye as langFromMime,Pe as mergeParams,Oe as normalizeServers,Me as pluralizeType,xe as serializeParameterValue,M as serializeParameterValueWithMime,C as serializeQueryParameter,Ae 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 I(e){return typeof e=="string"&&/\dxx/i.test(e)}function se(e){return e==="default"||E(e)||I(e)}function ae(e,r=!1){if(e==="default")return r?"error":"success";let t=typeof e=="string"?parseInt(e,10):e;if(I(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 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 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 me(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 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 M(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 h(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 M(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"),""):M(o,e);case"simple":return h(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 h(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 A=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function je(e){return A.test(e||"")}function $e(e){return e?.match(A)?.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 Ie(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function Oe(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])),g=t.map((u,f)=>({paramOrRef:u,pointer:_.join(i,["parameters",String(f)])}));return[...s,...g]}function Me(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 he=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 Ae(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,Ae 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,Oe as mergeParams,Me as normalizeServers,Se as pluralizeType,ge as serializeParameterValue,x as serializeParameterValueWithMime,J as serializeQueryParameter,Q as serializeQueryStringParameterValueWithMime,he as shortenHTTPVerb,Ie 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.19.0-next.0",
3
+ "version": "3.19.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.17.0",
24
+ "@redocly/openapi-core": "2.18.2",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.7",
27
27
  "fast-deep-equal": "^3.1.3",
@@ -29,7 +29,7 @@
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",
@@ -39,7 +39,7 @@
39
39
  "util": "~0.12.5",
40
40
  "web-vitals": "3.3.1",
41
41
  "@redocly/config": "0.43.0",
42
- "@redocly/replay": "0.22.0-next.0"
42
+ "@redocly/replay": "0.22.0-next.2"
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.63.0-next.0"
75
+ "@redocly/theme": "0.63.0-next.2"
76
76
  },
77
77
  "scripts": {
78
78
  "start": "pnpm run copy-highlight-hook && vite",