@redocly/openapi-docs 3.14.1 → 3.15.0-next.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.
|
@@ -21,4 +21,4 @@ import{jsx as n,jsxs as l,Fragment as f}from"react/jsx-runtime";import{memo as b
|
|
|
21
21
|
@media print {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
|
-
`;function O({scrollYOffset:e,className:a,children:d,collapsedSidebar:i}){const[t,p]=x("0px"),m=u(null),o=S(),[s,r]=y($);return h(()=>{o.hash&&r(!1)},[o.pathname,o.hash,r]),v(()=>{const c=e();p(`${c}px`)}),n(f,{children:l(j,{open
|
|
24
|
+
`;function O({scrollYOffset:e,className:a,children:d,collapsedSidebar:i}){const[t,p]=x("0px"),m=u(null),o=S(),[s,r]=y($);return h(()=>{o.hash&&r(!1)},[o.pathname,o.hash,r]),v(()=>{const c=e();p(`${c}px`)}),n(f,{children:l(j,{open:!!s,className:a,offsetTop:t,style:{top:t},ref:m,collapsedSidebar:i,children:[i||s?d:null,n(g,{})]})})}const C=b(O);export{C as StickyResponsiveSidebar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IS_BROWSER as q,isObject as S,isString as E,isUndefined as o}from"@redocly/theme/core/openapi";import{tryDecodeURIComponent as B,getDefinitionName as v}from"../utils/index.js";import{JsonPointer as x}from"../utils/JsonPointer.js";import{normalizeOptions as W}from"./config-options/normalizeOptions.js";function A(m,e){return e&&m[m.length-1]!==e?[...m,e]:m}function R(m,e){return e?m.concat(e):m}class V{options;definitionUrl;definition;allowMergeRefs=!1;constructor(e,t,l=W({})){this.options=l,this.definition=Object.assign({},e),this.validate(e),this.definition=e,this.allowMergeRefs=e.openapi.startsWith("3.1");const n=q?window.location.href:"";E(t)&&(this.definitionUrl=new URL(t,n).href)}validate(e){if(o(e.openapi))throw new Error("Document must be valid OpenAPI 3.0.0 definition")}byRef=e=>{let t;if(this.definition){e.charAt(0)!=="#"&&(e="#"+e),e=B(e);try{t=x.get(this.definition,e)}catch{}return t||{}}};isRef(e){return e?(e=e,e.$ref!==void 0&&e.$ref!==null):!1}deref(e,t=[],l=!1,n=0){const i=e?.["x-refsStack"];if(t=R(t,i),n>5)return{resolved:Object.assign({},e,{"x-complex":!0}),refsStack:t};if(this.isRef(e)){const r=v(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{resolved:{type:"object",title:r},refsStack:t};let s=this.byRef(e.$ref);if(!s)throw new Error(`Failed to resolve $ref "${e.$ref}"`);return t.includes(e.$ref)?s=Object.assign({},s,{"x-circular-ref":!0}):this.isRef(s)&&(s=this.deref(s,t,l,n).resolved),this.allowMergeRefs&&(s=this.mergeRefs(e,s,l)),{resolved:s,refsStack:A(t,e.$ref)}}return{resolved:e,refsStack:R(t,i)}}mergeRefs(e,t,l){const{$ref:n,...i}=e,r=Object.keys(i);if(r.length===0)return
|
|
1
|
+
import{IS_BROWSER as q,isObject as S,isString as E,isUndefined as o}from"@redocly/theme/core/openapi";import{tryDecodeURIComponent as B,getDefinitionName as v}from"../utils/index.js";import{JsonPointer as x}from"../utils/JsonPointer.js";import{normalizeOptions as W}from"./config-options/normalizeOptions.js";function A(m,e){return e&&m[m.length-1]!==e?[...m,e]:m}function R(m,e){return e?m.concat(e):m}class V{options;definitionUrl;definition;allowMergeRefs=!1;constructor(e,t,l=W({})){this.options=l,this.definition=Object.assign({},e),this.validate(e),this.definition=e,this.allowMergeRefs=e.openapi.startsWith("3.1");const n=q?window.location.href:"";E(t)&&(this.definitionUrl=new URL(t,n).href)}validate(e){if(o(e.openapi))throw new Error("Document must be valid OpenAPI 3.0.0 definition")}byRef=e=>{let t;if(this.definition){e.charAt(0)!=="#"&&(e="#"+e),e=B(e);try{t=x.get(this.definition,e)}catch{}return t||{}}};isRef(e){return e?(e=e,e.$ref!==void 0&&e.$ref!==null):!1}deref(e,t=[],l=!1,n=0){const i=e?.["x-refsStack"];if(t=R(t,i),n>5)return{resolved:Object.assign({},e,{"x-complex":!0}),refsStack:t};if(this.isRef(e)){const r=v(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{resolved:{type:"object",title:r},refsStack:t};let s=this.byRef(e.$ref);if(!s)throw new Error(`Failed to resolve $ref "${e.$ref}"`);return t.includes(e.$ref)?s=Object.assign({},s,{"x-circular-ref":!0}):this.isRef(s)&&(s=this.deref(s,t,l,n).resolved),this.allowMergeRefs&&(s=this.mergeRefs(e,s,l)),{resolved:s,refsStack:A(t,e.$ref)}}return{resolved:e,refsStack:R(t,i)}}mergeRefs(e,t,l){const{$ref:n,...i}=e,r=Object.keys(i);if(r.length===0)return{...t,$ref:n};if(l&&r.some(s=>!["description","title","externalDocs","x-refsStack","x-parentRefs","readOnly","writeOnly","x-complex"].includes(s))){const{description:s,title:p,readOnly:u,writeOnly:d,...O}=i;return{allOf:[{description:s,title:p,readOnly:u,writeOnly:d},t,O]}}else return{...t,...i}}mergeAllOf(e,t,l,n="",i=0){if(e["x-circular-ref"])return e;if(e=this.hoistOneOfs(e),e.allOf===void 0)return{absolutePointer:n,...e};let r={...e,"x-parentRefs":[],absolutePointer:x.join(n,["allOf"]),allOf:void 0,title:i===0?e.title||v(t):e.title};!o(r.properties)&&S(r.properties)&&(r.properties={...r.properties}),!o(r.items)&&S(r.items)&&(r.items={...r.items});const s=e.allOf.map((p,u)=>{const{resolved:d,refsStack:O}=this.deref(p,l,!0,i),f=p.$ref,y=f||x.join(n,[String(u)]);if(d["x-complex"])return{$ref:f,refsStack:A(O,f),schema:{"x-complex":!0},absolutePointer:y};const a=this.mergeAllOf(d,f,O,y,i+1);if(!(a["x-circular-ref"]&&a.allOf))return f&&r["x-parentRefs"]?.push(...a["x-parentRefs"]||[],f),{$ref:f,refsStack:A(O,f),schema:a,absolutePointer:y}}).filter(Boolean);for(const[p,{schema:u,refsStack:d,absolutePointer:O}]of s.entries()){const{type:f,enum:y,properties:a,items:b,required:w,title:I,description:D,readOnly:C,writeOnly:M,oneOf:$,anyOf:k,"x-circular-ref":g,"x-complex":P,...N}=u||{};if(!(r.type!==f&&!o(r.type)&&!o(f)&&!i)){if(o(f)||(Array.isArray(f)&&Array.isArray(r.type)?r.type=[...f,...r.type]:r.type=f),o(y)||(Array.isArray(y)&&Array.isArray(r.enum)?r.enum=Array.from(new Set([...y,...r.enum])):r.enum=y),!o(a)&&S(a)){r.properties=r.properties||{};for(const c in a){const h=R(d,a[c]?.["x-refsStack"]);if(!r.properties[c])r.properties[c]={...a[c],absolutePointer:x.join(O,["properties",c]),"x-refsStack":h};else if(!g){const U=this.mergeAllOf({allOf:[r.properties[c],a[c]],"x-refsStack":h},t+"/properties/"+c,h,x.join(O,["allOf",String(p),"properties",c]),i+1);r.properties[c]=U}}}if(!o(b)&&!g&&!P){const c=typeof r.items=="boolean"?{}:Object.assign({},r.items),h=typeof u.items=="boolean"?{}:Object.assign({},u.items);r.items=this.mergeAllOf({allOf:[c,h]},t+"/items",d,"",i+1)}o($)||(r.oneOf=$),o(k)||(r.anyOf=k),Array.isArray(w)&&(r.required=[...r.required||[],...w]),r={...r,title:r.title||I,description:r.description||D,readOnly:o(r.readOnly)?C:r.readOnly,writeOnly:o(r.writeOnly)?M:r.writeOnly,"x-circular-ref":r["x-circular-ref"]||g,"x-complex":r["x-complex"]||P,...N}}}return r}findDerived(e){const t={},l=this.definition.components&&this.definition.components.schemas||{};for(const n in l){const{resolved:i}=this.deref(l[n]);!o(i.allOf)&&i.allOf.find(r=>!o(r.$ref)&&e.indexOf(r.$ref)>-1)&&(t["#/components/schemas/"+n]=[i["x-discriminator-value"]||n])}return t}hoistOneOfs(e){if(o(e.allOf))return e;const{allOf:t,...l}=e;for(let n=0;n<t.length;n++){const{oneOf:i,...r}=t[n];if(i&&Array.isArray(i)){const s=t.slice(0,n),p=t.slice(n+1),u=Object.keys(r).length>0?[r]:[];return{...l,oneOf:i.map(d=>({allOf:[...s,...u,d,...p]}))}}}return e}}export{V as OpenAPIParser,R as concatRefStacks,A as pushRef};
|
package/lib/standalone.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as P,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function d(t){const e={},o=t.attributes;for(let r=0;r<o.length;r++){const n=o[r];e[n.name]=n.value}return e}function E(t){const e=d(t),o={};for(const r in e){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());o[n]=e[r]}return o}function A(t,e=document.querySelector("redoc")){m(e,i(l,{store:t}),{onRecoverableError:(o,r)=>{o.message.includes("Minified React error #418")||console.error(o.message,r)}})}function _(t,e={},o=a("redoc")){if(o===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}=e;let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(o).render(p(f,{definition:s,definitionUrl:c,options:{...n,...E(o)},router:r??"hash"},["Loading..."]))}const N=__REDOCLY_API_REFERENCE_VERSION__,v=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const e=t.getAttribute("spec-url");e&&_(e,{},t)}R();export{A as hydrate,_ as init,v as revision,D as setParameterValue,P as setSecurityDetails,V as setSecurityDetailsVariants,N as version};
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export declare function get<T>(object: GenericObject | undefined, path: string |
|
|
|
40
40
|
export declare function joinStringFactory(separator: string): (...args: (string | undefined)[]) => string;
|
|
41
41
|
export declare const dottedString: (...args: (string | undefined)[]) => string;
|
|
42
42
|
export declare function getWindowReferenceOptions<T>(option: string): T | null;
|
|
43
|
-
export declare function getJsUrl(): string;
|
|
44
43
|
export declare const normalizeText: (text?: string | GenericObject) => string;
|
|
45
44
|
export declare const getValueFromMdParsedExtension: (item: GenericObject, key: "description" | "summary" | "x-summary" | "x-enumDescriptions") => any;
|
|
46
45
|
export declare function getServerDisplayName(server: OpenAPIServer): string | undefined;
|
package/lib/utils/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isObject as i,isString as
|
|
1
|
+
import{isObject as i,isString as p}from"@redocly/theme/core/openapi";import{isNamedDefinition as a}from"./openapi.js";import{JsonPointer as f}from"./JsonPointer.js";import{urlParse as u}from"./url.js";import{IS_BROWSER as l}from"./dom.js";function w(r,e){const t=[];for(let n=0;n<r.length-1;n++)t.push(e(r[n],!1));return r.length!==0&&t.push(e(r[r.length-1],!0)),t}function A(r,e){const t={};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=e(r[n],n,r));return t}function R(r,e){const t=[],n=o=>{for(const s of o)t.push(s),s[e]&&n(s[e])};return n(r),t}function c(r){return r.endsWith("/")?r.substring(0,r.length-1):r}function b(r){return!isNaN(parseFloat(r))&&isFinite(r)}function E(r,e,t){const n=new RegExp(`(^|\\n)#\\s?${e}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${e}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(r))return r.replace(o,`$1
|
|
2
2
|
|
|
3
3
|
${t}
|
|
4
4
|
$4`);{const s=r===""||r.endsWith(`
|
|
@@ -9,4 +9,4 @@ $4`);{const s=r===""||r.endsWith(`
|
|
|
9
9
|
|
|
10
10
|
`;return`${r}${s}# ${e}
|
|
11
11
|
|
|
12
|
-
${t}`}}const
|
|
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(/&/g,"&").replace(/"/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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0-next.1",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"npm": ">=10.0.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@redocly/theme": ">=0.
|
|
17
|
+
"@redocly/theme": ">=0.59.0-next.0",
|
|
18
18
|
"react": "^19.1.0",
|
|
19
19
|
"react-dom": "^19.1.0",
|
|
20
20
|
"styled-components": "^4.1.1 || ^5.3.11 || ^6.0.0"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.35.1",
|
|
40
|
-
"@redocly/replay": "0.
|
|
40
|
+
"@redocly/replay": "0.18.0-next.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.6.2",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
77
|
"vite": "6.3.6",
|
|
78
|
-
"@redocly/theme": "0.
|
|
78
|
+
"@redocly/theme": "0.59.0-next.1"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|