@redocly/openapi-docs 3.15.0-next.2 → 3.15.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/redocly-openapi-docs.min.js +1870 -1695
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
- package/lib/components/RedoclyOpenAPIDocs/types.d.ts +0 -1
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/models/group.js +1 -1
- package/lib/models/types.d.ts +1 -0
- package/lib/services/menu/builder.js +1 -1
- package/lib/services/menu/tags.js +2 -2
- package/lib/services/types.d.ts +1 -0
- package/lib/standalone.d.ts +1 -1
- package/lib/standalone.js +1 -1
- package/lib/types/open-api.d.ts +2 -0
- package/package.json +4 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
2
|
import type { RedoclyOpenAPIDocsProps } from './types.js';
|
|
3
|
-
export declare function RedoclyOpenAPIDocs({ onLoaded, children, store, withCommonStyles, router,
|
|
3
|
+
export declare function RedoclyOpenAPIDocs({ onLoaded, children, store, withCommonStyles, router, }: PropsWithChildren<Partial<RedoclyOpenAPIDocsProps>>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as
|
|
1
|
+
import{jsx as o,jsxs as s,Fragment as C}from"react/jsx-runtime";import{memo as E,useRef as T}from"react";import{LayoutVariant as p}from"@redocly/config";import{useSetAtom as w}from"jotai";import{ThreePanelLayout as A}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as I}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as j,useMount as D}from"@redocly/theme/core/openapi";import{StoreProvider as M}from"./Providers.js";import{Overlay as N}from"../Overlay.js";import{RedocWrap as _}from"./styled.js";import{StickyResponsiveSidebar as V}from"../StickySidebar/index.js";import{SideMenu as k}from"../SideMenu/index.js";import{Content as v}from"../Content/index.js";import{useContentItems as B,useUppercase2LowercaseRedirect as K,useTelemetry as F,usePerformanceMetrics as H}from"../../hooks/index.js";import{withRouter as U}from"../../hoc/withRouter.js";import{withStore as Y}from"../../hoc/withStore.js";import{compose as G}from"../../utils/index.js";import{useLicense as W}from"../../hooks/useLicense.js";import{allOperationsAtom as q}from"../../jotai/replay.js";const z=G(U,Y,E)(({licenseKey:m,onLoaded:a,children:e,options:t,layout:i,collapsedSidebar:d,parser:c,withCommonStyles:y})=>{const b=T(null),{isValid:l,licenseInfo:g}=W(m),R=w(q),u=F();K();const{contentItems:h,flatItems:S}=B({parser:c,options:t});H({sendTelemetry:f=>{const r=Object.fromEntries(Object.entries(f).map(([O,x])=>[O.toLowerCase(),x]));u.sendOpenapiDocsPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),D(()=>{if(a?.(),u.sendOpenapiDocsViewedMessage({layout:i}),!t.hideReplay){const f=S.filter(r=>r.type==="operation");R(f)}});const{hideSidebar:P,scrollYOffset:L}=t||{},n=c.definition?.info?.["x-logo"];return s(C,{children:[y&&o(j,{}),s(_,{className:"redoc-wrap",ref:b,children:[!l&&o(N,{licenseInfo:g}),!P&&s(V,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!d,children:[o(I,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),o(k,{items:l?h:[]})]}),s(A,{className:"api-content",id:"api-content",layout:i===p.THREE_PANEL?p.THREE_PANEL:p.STACKED,collapsedSidebar:d,children:[o(v,{items:l?h:[],routingBasePath:t.routingBasePath}),e]})]})]})});function ue({onLoaded:m,children:a,store:e,withCommonStyles:t,router:i}){return e?.definition?o(M,{...e,children:o(z,{onLoaded:m,basePath:e.options?.routingBasePath,licenseKey:e.options?.licenseKey,disableRouter:e.options?.disableRouter,withCommonStyles:t,router:i,children:a})}):null}export{ue as RedoclyOpenAPIDocs};
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { useRouter } from './useRouter.js';
|
|
|
3
3
|
export { useContentItems } from './useContentItems.js';
|
|
4
4
|
export { useActiveWithFallback } from './useActiveWithFallback.js';
|
|
5
5
|
export { useTranslate } from './useTranslate.js';
|
|
6
|
-
export { useUppercase2LowercaseRedirect } from './useUppercase2LowercaseRedirect.js';
|
|
7
6
|
export { useTelemetry } from './useTelemetry.js';
|
|
7
|
+
export { useUppercase2LowercaseRedirect } from './useUppercase2LowercaseRedirect.js';
|
|
8
8
|
export { usePerformanceMetrics } from './usePerformanceMetrics.js';
|
package/lib/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useActivateExample as o}from"./useActivateExample.js";import{useRouter as s}from"./useRouter.js";import{useContentItems as p}from"./useContentItems.js";import{useActiveWithFallback as f}from"./useActiveWithFallback.js";import{useTranslate as x}from"./useTranslate.js";import{
|
|
1
|
+
import{useActivateExample as o}from"./useActivateExample.js";import{useRouter as s}from"./useRouter.js";import{useContentItems as p}from"./useContentItems.js";import{useActiveWithFallback as f}from"./useActiveWithFallback.js";import{useTranslate as x}from"./useTranslate.js";import{useTelemetry as i}from"./useTelemetry.js";import{useUppercase2LowercaseRedirect as n}from"./useUppercase2LowercaseRedirect.js";import{usePerformanceMetrics as A}from"./usePerformanceMetrics.js";export{o as useActivateExample,f as useActiveWithFallback,p as useContentItems,A as usePerformanceMetrics,s as useRouter,i as useTelemetry,x as useTranslate,n as useUppercase2LowercaseRedirect};
|
package/lib/models/group.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{joinWithSeparator as h}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as w}from"../utils/saveTextBeforeHeading.js";function r(i,e,s){let n;s?.id&&(i==="schema"||i==="mcp")?n=h(s.id,o(e.name)):n=e.id||o(e.name);const d=e["x-displayName"]||e.name,c=e.level||1,t=e.isSchema,f=e.ast||void 0,l=w(S(e,"description")||""),a=e.items||[],x=e.externalDocs;return{id:n.toLowerCase(),type:i,parent:s,name:d,level:c,depth:0,isSchema:t,description:l,items:a,ast:f,externalDocs:x,href:v({id:n}),[m]:e[m]||s?.[m],keywords:i==="tag"?e["x-keywords"]:void 0}}export{r as getTagOrGroup};
|
package/lib/models/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function
|
|
1
|
+
import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function E(o,s){const e=x(o,s),i=h(e||[],"items");return{contentItems:e,flatItems:i}}export{E as buildContentItems,x as buildMenuStructure};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as
|
|
2
|
-
{% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer
|
|
1
|
+
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as k,safeSlugify as w}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as x}from"./markdown.js";import{joinWithSeparator as $}from"../history/helpers.js";const y=["tools"];function N(s,c,o,e,a){let t;if(e===void 0?t=Object.keys(c):t=e.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(n=>c[n]?(c[n].used=!0,c[n]):(console.warn(`Non-existing tag "${n}" is added to the group "${e?.name}"`),null)),i=[];for(const n of f){if(!n)continue;const r=d("tag",n,o);if(r.depth=g+1,n.name===""){const P=[...x(h(n,"description")||"",r,r.depth+1),...T(void 0,n,r.depth+1)];i.push(...P);continue}const p=b({definition:s.definition,tag:n,parent:r,schemaDefinitionsTagName:a.schemaDefinitionsTagName}),m=v(s.definition,n,r);r.items=[...p,...m,...x(h(n,"description")||"",r,r.depth+1),...T(r,n,r.depth+1)],i.push(r)}return i.filter(({name:n,items:r})=>n!==l||r.length>0)}function R(s,c,o,e,a){const t=[];for(const f of o){const i=d("group",f,c);i.depth=g,i.items=N(s,e,i,f,a),t.push(i)}return t}function b({definition:s,tag:c,parent:o,schemaDefinitionsTagName:e}){const a=e?[e]:[];return Object.entries(s.components?.schemas||{}).map(([t,f])=>{if(!(f["x-tags"]||a).includes(c.name))return null;const n=d("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return n.depth=o.depth+1,n}).filter(Boolean)}function v(s,c,o){const e=[];for(const a of y)if(s["x-mcp"]?.[a]){const t=O(a),f=[t];for(const i of s["x-mcp"]?.[a]||[])if((i.tags?.length?i.tags:f).includes(c.name)){const r=$(o.id,w(i.name)),p=d("mcp",{name:i.name,"x-displayName":i.title||i.name,description:`${i.description||""}
|
|
2
|
+
{% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer:k.compile(["paths",a,i]),httpVerb:i,pathParameters:t.parameters||[],pathServers:t.servers,isWebhook:!!e,keywords:n["x-keywords"]})}}}}function O(s){return s.charAt(0).toUpperCase()+s.slice(1)}export{O as capitalize,R as getTagGroupsItems,N as getTagsItems,U as getTagsWithOperations};
|
package/lib/services/types.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export type ExtendedOpenAPIOperation = {
|
|
|
51
51
|
pathServers: Array<OpenAPIServer> | undefined;
|
|
52
52
|
isWebhook: boolean;
|
|
53
53
|
defaultSampleName?: string | false;
|
|
54
|
+
keywords?: unknown;
|
|
54
55
|
} & OpenAPIOperation;
|
|
55
56
|
export type TagsInfoMap = Record<string, TagInfo>;
|
|
56
57
|
export interface TagGroup {
|
package/lib/standalone.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { OpenAPIDefinition } from './types/open-api.js';
|
|
|
3
3
|
import type { StoreProviderProps } from './components/RedoclyOpenAPIDocs/types.js';
|
|
4
4
|
export { setSecurityDetails, setSecurityDetailsVariants } from './utils/security-details.js';
|
|
5
5
|
export { setParameterValue } from './utils/parameters.js';
|
|
6
|
-
export declare function hydrate(store: StoreProviderProps, element?: Element | null
|
|
6
|
+
export declare function hydrate(store: StoreProviderProps, element?: Element | null): void;
|
|
7
7
|
export declare function init(definitionOrDefinitionUrl: string | OpenAPIDefinition, options?: RedocConfig & {
|
|
8
8
|
router?: 'hash' | 'history';
|
|
9
9
|
disableTelemetry?: boolean;
|
package/lib/standalone.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{createElement as l}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as i}from"./utils/dom.js";import{RedoclyOpenAPIDocs as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as d}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as V,setSecurityDetailsVariants as j}from"./utils/security-details.js";import{setParameterValue as F}from"./utils/parameters.js";function E(e){const o={},t=e.attributes;for(let r=0;r<t.length;r++){const s=t[r];o[s.name]=s.value}return o}function _(e){const o=E(e),t={};for(const r in o){const s=r.replace(/-(.)/g,(a,n)=>n.toUpperCase());t[s]=o[r]}return t}function N(e,o=document.querySelector("redoc")){m(o,p(f,{store:e}),{onRecoverableError:(t,r)=>{t.message.includes("Minified React error #418")||console.error(t.message,r)}})}function R(e,o={},t=i("redoc")){if(t===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,disableTelemetry:s,...a}={...o,..._(t)};let n,c;typeof e=="string"?n=e:typeof e=="object"&&(c=e),u(t).render(l(d,{definition:c,definitionUrl:n,disableTelemetry:s,options:a,router:r??"hash"},["Loading..."]))}const v=__REDOCLY_API_REFERENCE_VERSION__,C=__REDOCLY_API_REFERENCE_REVISION__;function y(){const e=i("redoc");if(!e)return;const o=e.getAttribute("spec-url");if(o){const t=e.getAttribute("disable-telemetry")==="true";R(o,{disableTelemetry:t},e)}}y();export{N as hydrate,R as init,C as revision,F as setParameterValue,V as setSecurityDetails,j as setSecurityDetailsVariants,v as version};
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface OpenAPIDefinition {
|
|
|
18
18
|
}>;
|
|
19
19
|
'x-feedback'?: any;
|
|
20
20
|
'x-schema-catalog-link'?: string;
|
|
21
|
+
'x-keywords'?: unknown;
|
|
21
22
|
}
|
|
22
23
|
export interface OpenAPIInfo extends ParsedDescriptionWithSummary {
|
|
23
24
|
title: string;
|
|
@@ -361,6 +362,7 @@ export interface OpenAPITag extends ParsedDescription {
|
|
|
361
362
|
externalDocs?: OpenAPIExternalDocumentation;
|
|
362
363
|
'x-displayName'?: string;
|
|
363
364
|
'x-rbac'?: Record<string, unknown>;
|
|
365
|
+
'x-keywords'?: unknown;
|
|
364
366
|
}
|
|
365
367
|
export interface OpenAPIExternalDocumentation extends ParsedDescription {
|
|
366
368
|
description?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.15.0-next.
|
|
3
|
+
"version": "3.15.0-next.4",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"fast-deep-equal": "^3.1.3",
|
|
28
28
|
"jotai": "^2.12.5",
|
|
29
29
|
"json-pointer": "^0.6.2",
|
|
30
|
-
"openapi-sampler": "
|
|
30
|
+
"openapi-sampler": "1.6.2",
|
|
31
31
|
"react-router-dom": "^6.21.1",
|
|
32
32
|
"slugify": "^1.4.4",
|
|
33
33
|
"stringify-object": "^3.3.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.36.0",
|
|
40
|
-
"@redocly/replay": "0.18.0-next.
|
|
40
|
+
"@redocly/replay": "0.18.0-next.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
77
|
"vite": "7.1.9",
|
|
78
|
-
"@redocly/theme": "0.59.0-next.
|
|
78
|
+
"@redocly/theme": "0.59.0-next.3"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|