@redocly/openapi-docs 3.12.0-next.8 → 3.12.0-rc.10
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 +1236 -1229
- package/lib/components/ApiInfo/ApiInfo.js +1 -1
- package/lib/components/ApiInfo/Metadata.js +1 -1
- package/lib/components/Overview/Overview.js +1 -1
- package/lib/components/PanelItem/styled.js +7 -3
- package/lib/components/RightPanel/RightPanel.js +1 -1
- package/lib/components/ServerList/ServerList.js +10 -10
- package/lib/components/TagItem/TagItem.js +2 -1
- package/lib/components/common/Fields/fields.js +5 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/services/menu/markdown.js +1 -1
- package/lib/services/types.d.ts +6 -0
- package/lib/types/open-api.d.ts +7 -0
- package/lib/utils/openapi.js +1 -1
- package/lib/utils/string.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useAtomValue as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useAtomValue as D}from"jotai";import{LayoutVariant as h}from"@redocly/config";import{AfterOpenApiTitle as k}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle";import{AfterOpenApiDescription as H}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiDescription";import{SamplesMiddlePanel as M,Row as S}from"../common/index.js";import{ExternalDocumentation as T}from"../ExternalDocumentation/index.js";import{Markdown as m}from"../Markdown/index.js";import{ApiHeader as j}from"./styled.js";import{globalStoreAtom as v}from"../../jotai/store.js";import{saveTextBeforeHeading as y}from"../../utils/saveTextBeforeHeading.js";import{getValueFromMdParsedExtension as p}from"../../utils/helpers.js";import{RenderHook as l}from"../RenderHook/index.js";import{Metadata as g}from"./Metadata.js";import{useTranslate as E}from"../../hooks/index.js";function q({item:f,layout:t}){const c=E(),{options:{unstable_hooks:i,hideInfoMetadata:d},parser:{definition:u}}=D(v),o=f.infoDefinition;if(!o)return null;const n=y(p(o,"description")||""),a=p(o,"summary")||void 0,s=u?.externalDocs||o?.externalDocs,x=o.version&&e("span",{children:["(",o.version,")"]})||null,A=t===h.STACKED;return r(S,{layout:t,children:e(M,{fullWidth:!0,className:"api-info",isStacked:A,children:[e(j,{children:[o.title," ",x]}),r(l,{Hook:k||i?.AfterApiTitle,props:{info:o}}),a&&r(m,{source:a,"data-role":"redoc-summary"}),n&&r(m,{source:n,"data-role":"redoc-description"}),r(l,{Hook:H||i?.AfterOpenApiDescription,props:{info:o}}),s&&r(T,{externalDocs:s}),!d&&r(g,{metadata:o["x-metadata"],translate:c})]})})}export{q as ApiInfo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useMemo as c}from"react";import{Markdown as d}from"@redocly/theme/components/Markdown/Markdown";import{H3 as p}from"@redocly/theme/components/Typography/H3";import{isNotNull as a}from"@redocly/theme/core/openapi";import{isAbsoluteUrl as s}from"../../utils/helpers.js";const f=["title","description"];function m([t,r]){return f.includes(t)?null:Array.isArray(r)?{key:t,value:r.filter(o=>typeof o!="object").join(", ")}:typeof r=="object"?null:{key:t,value:r}}function y({metadata:t,translate:r}){const o=c(()=>Object.entries(t||{}).map(m).filter(a),[t]);return t?n(d,{children:[e(p,{children:r("openapi.info.metadata.title","Metadata")}),n("table",{className:"md",children:[e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:r("openapi.key","Key")}),e("th",{scope:"col",children:r("openapi.value","Value")})]})}),e("tbody",{children:o.map(({key:l,value:i})=>n("tr",{children:[e("td",{children:l}),e("td",{children:typeof i=="string"&&s(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:i}):String(i)})]},l))})]})]}):null}export{y as Metadata};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as h,Fragment as b}from"react/jsx-runtime";import{useAtomValue as f}from"jotai";import{CopyButton as v}from"@redocly/theme/components/Buttons/CopyButton";import{NewTabButton as c}from"@redocly/theme/components/Buttons/NewTabButton";import{EmailButton as B}from"@redocly/theme/components/Buttons/EmailButton";import{AdditionalOverviewInfo as O}from"@redocly/theme/components/OpenApiDocs/hooks/AdditionalOverviewInfo";import{PanelItem as a,PanelItemDescription as l,PanelItemsList as _}from"../PanelItem/index.js";import{globalStoreAtom as g}from"../../jotai/store.js";import{RenderHook as w}from"../RenderHook/RenderHook.js";function E({info:e,translate:n}){const{options:o}=f(g),{unstable_hooks:i}=o||{},m=e.contact&&e.contact.url&&t(a,{header:t(l,{children:n("openapi.info.contact.url","URL")}),title:t("a",{href:e.contact.url,target:"_blank",rel:"noreferrer",children:e.contact.url}),actions:[t(c,{data:e.contact.url},"NewTabButton")]})||null,s=e.contact&&e.contact.email&&t(a,{header:t(l,{children:e.contact.name||n("openapi.info.contact.name","E-mail")}),title:t("a",{href:"mailto:"+e.contact.email,children:e.contact.email}),actions:[t(v,{data:e.contact.email},"CopyButton"),t(B,{data:e.contact.email},"EmailButton")]})||null,u=e.license&&t(a,{header:t(l,{children:n("openapi.info.license","License")}),title:e.license.identifier?e.license.identifier:t("a",{href:e.license.url,target:"_blank",rel:"noreferrer",children:e.license.name}),actions:[t(c,{data:e.license.url||""},"NewTabButton")]})||null,p=e.termsOfService&&t(a,{title:t("a",{href:e.termsOfService,target:"_blank",rel:"noreferrer",children:n("openapi.info.termsOfService","Terms of Service")}),actions:[t(c,{data:e.termsOfService},e.termsOfService)]})||null,d=e["x-links"]?.map(r=>t(a,{header:t(l,{children:r.name}),title:t("a",{href:r.url,target:"_blank",rel:"noreferrer",children:r.url}),actions:[t(c,{data:r.url},"NewTabButton")]},r.url))||null;return t(b,{children:h(_,{children:[m,s,u,p,d,t(w,{Hook:O||i?.AfterOpenApiInfo,props:{info:e}})]})})}export{E as Overview};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{styled as t}from"../../styled-components.js";const
|
|
1
|
+
import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{styled as t}from"../../styled-components.js";const a=t.span`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|
|
5
5
|
padding: 0;
|
|
6
6
|
position: relative;
|
|
7
7
|
width: 100%;
|
|
8
|
-
`,
|
|
8
|
+
`,r=t.span`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
justify-content: flex-start;
|
|
@@ -43,10 +43,14 @@ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"
|
|
|
43
43
|
font-size: var(--font-size-base);
|
|
44
44
|
line-height: var(--line-height-base);
|
|
45
45
|
font-weight: var(--font-weight-medium);
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--spacing-xs);
|
|
49
|
+
justify-content: flex-start;
|
|
46
50
|
`,m=t(o)`
|
|
47
51
|
width: 14px;
|
|
48
52
|
height: 14px;
|
|
49
53
|
position: absolute;
|
|
50
54
|
left: -18px;
|
|
51
55
|
bottom: 3px;
|
|
52
|
-
`;export{p as ActionsWrap,s as Header,
|
|
56
|
+
`;export{p as ActionsWrap,s as Header,r as Item,d as PanelItemDescription,a as PanelItemWrap,c as PanelItemsList,m as StyledCheckmarkIcon,l as Title};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as
|
|
1
|
+
import{jsx as e,Fragment as f,jsxs as v}from"react/jsx-runtime";import{useAtomValue as l}from"jotai";import{Panel as i}from"@redocly/theme/components/Panel/Panel";import{Markdown as u}from"@redocly/theme/components/Markdown/Markdown";import{DownloadSpecification as h}from"../Download/index.js";import{Overview as x}from"../Overview/index.js";import{LanguageList as w}from"../Language/index.js";import{ServerList as L}from"../ServerList/index.js";import{globalStoreAtom as S}from"../../jotai/store.js";import{normalizeServers as b}from"../../utils/index.js";import{mergeInMockServer as j}from"../../models/operation.js";import{languageAtom as k}from"../../jotai/app.js";import{useTranslate as A}from"../../hooks/index.js";const U=({item:{infoDefinition:a}})=>{const r=A(),{options:{hideDownloadButtons:m,mockServer:p},parser:{definition:d,definitionUrl:c}}=l(S),{languages:n,activeLanguage:g}=l(k),s=b(c,j(d.servers||[],p)).sort((o,t)=>o["x-isLive"]&&!t["x-isLive"]?-1:!o["x-isLive"]&&t["x-isLive"]?1:0);return v(f,{children:[!m&&e(i,{className:"panel-download",header:r("openapi.download.description.title","Download OpenAPI description"),isExpandable:!1,children:e(h,{})}),(a?.license||a?.contact||a?.termsOfService)&&e(i,{className:"panel-overview",header:r("openapi.info.title","Overview"),isExpandable:!1,children:e(u,{children:e(x,{info:a,translate:r})})}),!!n?.length&&e(i,{className:"panel-language-list",header:r("openapi.languages.title","Languages"),isExpandable:!1,children:e(w,{languages:n,activeLanguage:g})}),!!s.length&&e(i,{className:"panel-servers-list",header:r("openapi.servers.title","Servers"),isExpandable:!1,children:e(L,{servers:s,path:"/",translate:r})})]})};export{U as RightPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as
|
|
1
|
+
import{jsx as i,jsxs as r}from"react/jsx-runtime";import{CopyButton as f}from"@redocly/theme/components/Buttons/CopyButton";import{CheckmarkFilledIcon as u}from"@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon";import{PanelItemDescription as h,Title as y}from"../PanelItem/index.js";import{ViewNested as w}from"../ViewNested/index.js";import{Tag as l}from"../common/index.js";import{Markdown as $}from"../Markdown/index.js";import{styled as o}from"../../styled-components.js";const _=({servers:b,path:v,translate:t})=>i(j,{children:b.map(e=>{const s=e.url+v,p=Object.keys(e.variables||{}).length,c=p===1?"variable":"variables",m=`${p||""} ${t(`openapi.${c}`,c)}`;return r("div",{children:[r(h,{children:[e.description," ",e["x-isLive"]&&r(l,{className:"tag-green",children:[i(u,{}),"Live"]})]}),e["x-labels"]?.length&&i(h,{style:{margin:"var(--spacing-xs) 0"},children:e["x-labels"]?.map(n=>r(l,{className:`tag-${n.color}`,children:[n.label,": ",n.value]},n.value))})||null,r(L,{children:[i(y,{suppressHydrationWarning:!0,children:s}),i(f,{data:s},s)]}),e.variables&&i(w,{expandText:`${t("openapi.actions.show","Show")} ${m}`,hideText:`${t("openapi.actions.hide","Hide")} ${m}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i(S,{children:Object.entries(e.variables||{}).map(([n,a])=>r(T,{children:[i(k,{children:n}),r(d,{children:[t("openapi.default","Default")," ",i(x,{children:a.default})]}),i(z,{source:a.description}),a.enum&&r(d,{children:[t("openapi.enum","Enum")," ",i(D,{children:a.enum.map(g=>i(x,{children:g},g))})]})]},n))})})]},e.url)})}),j=o.div`
|
|
2
2
|
& > div {
|
|
3
3
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
4
4
|
margin-bottom: var(--spacing-xs);
|
|
@@ -10,7 +10,7 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
|
|
|
10
10
|
margin-bottom: 0;
|
|
11
11
|
padding-bottom: 0;
|
|
12
12
|
}
|
|
13
|
-
`,S=
|
|
13
|
+
`,S=o.div`
|
|
14
14
|
padding-left: var(--spacing-xxs);
|
|
15
15
|
& > div {
|
|
16
16
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
@@ -28,32 +28,32 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
|
|
|
28
28
|
margin-bottom: 0;
|
|
29
29
|
padding-bottom: 0;
|
|
30
30
|
}
|
|
31
|
-
`,T=
|
|
31
|
+
`,T=o.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
flex-wrap: wrap;
|
|
35
|
-
|
|
35
|
+
`,z=o($)`
|
|
36
36
|
font-size: var(--font-size-sm);
|
|
37
37
|
line-height: var(--line-height-sm);
|
|
38
38
|
color: var(--text-color-primary);
|
|
39
|
-
`,
|
|
39
|
+
`,d=o.span`
|
|
40
40
|
display: flex;
|
|
41
41
|
gap: var(--spacing-xxs);
|
|
42
42
|
font-size: var(--font-size-sm);
|
|
43
43
|
line-height: var(--line-height-sm);
|
|
44
44
|
color: var(--text-color-primary);
|
|
45
|
-
`,
|
|
45
|
+
`,k=o(d)`
|
|
46
46
|
padding-bottom: var(--spacing-xxs);
|
|
47
47
|
font-weight: var(--font-weight-semibold);
|
|
48
|
-
`,D=
|
|
48
|
+
`,D=o.span`
|
|
49
49
|
display: flex;
|
|
50
50
|
gap: var(--spacing-xxs);
|
|
51
51
|
flex-wrap: wrap;
|
|
52
|
-
`,
|
|
52
|
+
`,x=o(l)`
|
|
53
53
|
font-size: var(--font-size-sm);
|
|
54
54
|
line-height: var(--line-height-sm);
|
|
55
|
-
`,
|
|
55
|
+
`,L=o.div`
|
|
56
56
|
display: flex;
|
|
57
57
|
justify-content: space-between;
|
|
58
58
|
align-items: center;
|
|
59
|
-
`;export{
|
|
59
|
+
`;export{_ as ServerList};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as t}from"react/jsx-runtime";import{memo as u,useCallback as h}from"react";import{useNavigate as v}from"react-router-dom";import{useAtomValue as x}from"jotai";import{LayoutVariant as b}from"@redocly/config";import{breakpoints as k}from"@redocly/theme/core/openapi";import{Button as w}from"@redocly/theme/components/Button/Button";import{H2 as y}from"@redocly/theme/components/Typography/H2";import{LinkIcon as S}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{Row as C,SamplesMiddlePanel as j,ShareLink as T}from"../common/index.js";import{Markdown as $}from"../Markdown/index.js";import{OperationsNavigation as A}from"./OperationsNavigation.js";import{layoutAtom as I}from"../../jotai/app.js";import{useTranslate as L}from"../../hooks/index.js";import{styled as n}from"../../styled-components.js";function B({item:o,routingBasePath:r="",isExpanded:e}){const l=L(),{description:p,name:m,href:d}=o,s=v(),c=x(I),g=h(()=>{s(r+o.href)},[o.href,s,r]),a=!!o.items.length,f=c===b.STACKED;return t(H,{expanded:e,children:[t(C,{layout:c,children:[t(j,{fullWidth:!a,isStacked:f,children:[t(N,{children:[i(T,{to:d,"aria-label":`link to ${m}`}),m]}),i($,{source:p})]}),a&&i(A,{items:o.items,routingBasePath:r})]}),a&&!e&&t(M,{type:"button",variant:"text",size:"medium",onClick:g,children:["+ ",l("openapi.actions.show","Show")]})]})}const U=u(B),H=n.div`
|
|
2
2
|
padding-top: var(--spacing-lg);
|
|
3
3
|
padding-bottom: ${({expanded:o})=>o?"var(--spacing-xxl)":""};
|
|
4
4
|
`,M=n(w)`
|
|
@@ -19,4 +19,5 @@ import{jsx as r,jsxs as t}from"react/jsx-runtime";import{memo as u,useCallback a
|
|
|
19
19
|
visibility: visible;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
overflow-wrap: break-word;
|
|
22
23
|
`;export{U as TagItem,B as TagItemComponent};
|
|
@@ -7,7 +7,7 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
7
7
|
color: var(--schema-type-text-color);
|
|
8
8
|
`,d=r(o)`
|
|
9
9
|
color: var(--schema-type-text-color);
|
|
10
|
-
`,
|
|
10
|
+
`,p=r(o)`
|
|
11
11
|
color: var(--schema-type-title-text-color);
|
|
12
12
|
word-break: break-word;
|
|
13
13
|
`,c=r(o).attrs({as:"div"})`
|
|
@@ -16,7 +16,7 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
16
16
|
line-height: var(--schema-labels-line-height);
|
|
17
17
|
font-weight: normal;
|
|
18
18
|
display: block;
|
|
19
|
-
`,
|
|
19
|
+
`,m=r(o)`
|
|
20
20
|
color: var(--schema-property-required-label-text-color);
|
|
21
21
|
font-size: var(--font-size-base);
|
|
22
22
|
line-height: var(--line-height-base);
|
|
@@ -32,6 +32,8 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
32
32
|
color: var(--text-color-secondary);
|
|
33
33
|
display: inline-flex;
|
|
34
34
|
word-break: var(--code-word-break);
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--spacing-xxs);
|
|
35
37
|
`,v=r(e)`
|
|
36
38
|
color: var(--schema-property-access-label-text-color);
|
|
37
39
|
background-color: var(--bg-color);
|
|
@@ -89,4 +91,4 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
89
91
|
padding: 0;
|
|
90
92
|
font-size: var(--font-size-sm);
|
|
91
93
|
line-height: var(--line-height-sm);
|
|
92
|
-
`;export{v as AccessLabel,b as AdditionalPropertiesLabel,u as ConstraintItem,x as DefaultValue,g as EnumValue,l as ExampleValue,f as ExtensionValue,o as FieldLabel,a as FieldValueLabel,c as PropertyLabel,h as RecursiveLabel,
|
|
94
|
+
`;export{v as AccessLabel,b as AdditionalPropertiesLabel,u as ConstraintItem,x as DefaultValue,g as EnumValue,l as ExampleValue,f as ExtensionValue,o as FieldLabel,a as FieldValueLabel,c as PropertyLabel,h as RecursiveLabel,m as RequiredLabel,e as Tag,y as ToggleButton,d as TypeName,i as TypePrefix,p as TypeTitle};
|
package/lib/index.d.ts
CHANGED
|
@@ -50,5 +50,6 @@ export { getValueFromMdParsedExtension } from './utils/helpers.js';
|
|
|
50
50
|
export { ContentItem } from './components/ContentItem/index.js';
|
|
51
51
|
export { ExampleSwitch } from './components/Samples/ExampleSwitch.js';
|
|
52
52
|
export { CustomBadges } from './components/common/Badges.js';
|
|
53
|
+
export { PanelItem } from './components/PanelItem/PanelItem.js';
|
|
53
54
|
export { useDownloadInfo } from './components/Download/useDownloadInfo.js';
|
|
54
55
|
export { SECTION_ATTR } from './constants.js';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useAtomValue as e}from"jotai";import{globalOptionsAtom as o}from"./jotai/store.js";import{simplifyAstStructure as n}from"./utils/simplifyAstStructure.js";import{getOperation as x}from"./models/operation.js";import{getServerEnvName as l}from"./utils/environments.js";import{getTagOrGroup as d}from"./models/group.js";import{generateDeepLink as c}from"./components/common/LinkToField.js";import{RequestSamples as
|
|
1
|
+
import{useAtomValue as e}from"jotai";import{globalOptionsAtom as o}from"./jotai/store.js";import{simplifyAstStructure as n}from"./utils/simplifyAstStructure.js";import{getOperation as x}from"./models/operation.js";import{getServerEnvName as l}from"./utils/environments.js";import{getTagOrGroup as d}from"./models/group.js";import{generateDeepLink as c}from"./components/common/LinkToField.js";import{RequestSamples as S}from"./components/RequestSamples/RequestSamples.js";import{ResponseSamples as O}from"./components/ResponseSamples/ResponseSamples.js";import{RedocSchema as R}from"./components/pluggable/RedocSchema.js";import{RedocExample as w}from"./components/pluggable/RedocExample.js";import{RedoclyOpenAPIDocs as v}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{StoreProvider as E}from"./components/RedoclyOpenAPIDocs/Providers.js";import{getMarkdownHeaderId as A}from"./components/RedoclyOpenAPIDocs/utils.js";import{safeSlugify as b}from"./utils/string.js";import{JsonPointer as L}from"./utils/JsonPointer.js";import{isOperationName as V}from"./utils/openapi.js";import{pathIncludesLink as F,normalizePath as H}from"./utils/path.js";import{saveTextBeforeHeading as z}from"./utils/saveTextBeforeHeading.js";import{OpenAPIParser as G}from"./services/OpenAPIParser.js";import{buildContentItems as _}from"./services/menu/builder.js";import{normalizeOptions as K}from"./services/config-options/normalizeOptions.js";import{makeDeepLink as U}from"./services/history/helpers.js";function p(){return e(o)}import{EmbeddedReplay as X}from"./components/Replay/EmbeddedReplay.js";import{convertOperationToReplayValue as Z}from"./components/Replay/utils.js";import{SectionContainer as ee}from"./components/SectionContent/index.js";import{Row as re}from"./components/common/panels.js";import{RightPanelContainer as pe}from"./components/SectionContent/index.js";import{Overview as ae}from"./components/Overview/index.js";import{SamplesMiddlePanel as fe,Section as xe,SamplesPanel as ie}from"./components/common/panels.js";import{Heading as se}from"./components/common/OperationItemTitle.js";import{Dropdown as ue}from"./components/common/Dropdown/index.js";import{Markdown as Pe}from"./components/Markdown/index.js";import{FieldValueLabel as ge,FieldLabel as Oe}from"./components/common/Fields/index.js";import{CodeBlockPanel as Re}from"./components/common/index.js";import{OperationSamplesPanel as we}from"./components/OperationItem/OperationItem.js";import{ExternalDocumentation as ve}from"./components/ExternalDocumentation/index.js";import{PropertyDetails as Ee}from"./components/PropertyDetails/PropertyDetails.js";import{addMarkdownItems as Ae}from"./services/menu/markdown.js";import{getValueFromMdParsedExtension as be}from"./utils/helpers.js";import{ContentItem as Le}from"./components/ContentItem/index.js";import{ExampleSwitch as Ve}from"./components/Samples/ExampleSwitch.js";import{CustomBadges as Fe}from"./components/common/Badges.js";import{PanelItem as Ne}from"./components/PanelItem/PanelItem.js";import{useDownloadInfo as qe}from"./components/Download/useDownloadInfo.js";import{SECTION_ATTR as Je}from"./constants.js";export{Re as CodeBlockPanel,Le as ContentItem,Fe as CustomBadges,ue as Dropdown,X as EmbeddedReplay,Ve as ExampleSwitch,ve as ExternalDocumentation,Oe as FieldLabel,ge as FieldValueLabel,se as Heading,L as JsonPointer,Pe as Markdown,G as OpenAPIParser,we as OperationSamplesPanel,ae as Overview,Ne as PanelItem,Ee as PropertyDetails,w as RedocExample,R as RedocSchema,v as RedoclyOpenAPIDocs,S as RequestSamples,O as ResponseSamples,pe as RightPanelContainer,re as Row,Je as SECTION_ATTR,fe as SamplesMiddlePanel,ie as SamplesPanel,xe as Section,ee as SectionContainer,E as StoreProvider,Ae as addMarkdownItems,_ as buildContentItems,Z as convertOperationToReplayValue,c as generateDeepLink,A as getMarkdownHeaderId,x as getOperation,l as getServerEnvName,d as getTagOrGroup,be as getValueFromMdParsedExtension,V as isOperationName,U as makeDeepLink,K as normalizeOptions,H as normalizePath,F as pathIncludesLink,b as safeSlugify,z as saveTextBeforeHeading,n as simplifyAstStructure,qe as useDownloadInfo,p as useOpenapiDocsOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import h from"@markdoc/markdoc";import{isString as T}from"@redocly/theme/core/openapi";import{getTagOrGroup as d}from"../../models/index.js";import{safeSlugify as y,unescapeHTMLChars as A}from"../../utils/index.js";function x(e,n,a){const i=T(e)?h.parse(e):h.Ast.fromJSON(JSON.stringify(e?.result)),s=[];let o;const l=(t,u,g=s,r,p)=>{t=A(t);let f;r.attributes.id?f=r.attributes.id:(f=p?`${p}/${y(t)}`:`section/${y(t)}`,r.attributes.id=f);const b={id:f.toLowerCase(),name:t,level:u,items:[],ast:[r]};return g.push(b),b},c=(t,u)=>{t[t.length-1]?.ast?.push(u)},m=t=>{const u=C(t)||"",r=n&&n.type==="tag"?n.id:void 0;t.type==="heading"&&t.attributes.level===1?o=l(u,t.attributes.level,void 0,t,r):t.attributes.level?l(u,t.attributes.level,o?.items,t,o?.id??r):o?.items?.length?c(o?.items,t):s?.length&&c(s,t)};if(Array.isArray(i))for(const t of i)m(t);else m(i);return v(n,s,a)}function v(e,n,a=1){return n.map(i=>{const s=d("section",i,e);return s.depth=a,i.items&&(s.items=v(s,i.items,a+1)),s})}function C(e){if(typeof e?.attributes?.content=="string")return e.attributes?.content;if(e?.children)return C(e.children[0])}export{x as addMarkdownItems};
|
package/lib/services/types.d.ts
CHANGED
|
@@ -91,6 +91,9 @@ export interface HooksConfig {
|
|
|
91
91
|
AfterApiTitle?: HookConfig<{
|
|
92
92
|
info: OpenAPIInfo;
|
|
93
93
|
}>;
|
|
94
|
+
AfterOpenApiDescription?: HookConfig<{
|
|
95
|
+
info: OpenAPIInfo;
|
|
96
|
+
}>;
|
|
94
97
|
BeforeOperation?: HookConfig<{
|
|
95
98
|
operation: OperationModel;
|
|
96
99
|
}>;
|
|
@@ -112,6 +115,9 @@ export interface HooksConfig {
|
|
|
112
115
|
sanitize?: (raw: string) => string;
|
|
113
116
|
MiddlePanelFooter?: HookConfig<undefined>;
|
|
114
117
|
MiddlePanelHeader?: HookConfig<undefined>;
|
|
118
|
+
AfterOpenApiInfo?: HookConfig<{
|
|
119
|
+
info: OpenAPIInfo;
|
|
120
|
+
}>;
|
|
115
121
|
}
|
|
116
122
|
export type ExtendedMenuItem = Omit<IMenuItem, 'type'> & {
|
|
117
123
|
type: MenuItemType | 'spec';
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface OpenAPIDefinition {
|
|
|
3
3
|
openapi: string;
|
|
4
4
|
info: OpenAPIInfo;
|
|
5
5
|
servers?: OpenAPIServer[];
|
|
6
|
+
'x-servers'?: OpenAPIServer[];
|
|
6
7
|
paths: OpenAPIPaths;
|
|
7
8
|
components?: OpenAPIComponents;
|
|
8
9
|
security?: OpenAPISecurityRequirement[];
|
|
@@ -46,6 +47,12 @@ export interface OpenAPIServer extends ParsedDescription {
|
|
|
46
47
|
url: string;
|
|
47
48
|
description?: string;
|
|
48
49
|
variables?: OpenAPIServerVariables;
|
|
50
|
+
'x-isLive'?: boolean;
|
|
51
|
+
'x-labels'?: {
|
|
52
|
+
label?: string;
|
|
53
|
+
color?: string;
|
|
54
|
+
value: string;
|
|
55
|
+
}[];
|
|
49
56
|
}
|
|
50
57
|
export interface OpenAPIServerVariables {
|
|
51
58
|
[name: string]: OpenAPIServerVariable;
|
package/lib/utils/openapi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as y}from"path";import f from"url-template";import{IS_BROWSER as M}from"@redocly/theme/core/openapi";import{deleteEmptyArrayItem as E,isArrayOfObjects as T,isNumeric as S,removeQueryStringAndHash as z,resolveUrl as D,sanitizeItemId as m,normalizeText as b,getValueFromMdParsedExtension as g,isAbsoluteUrl as N}from"./helpers.js";import{DEFAULT_TAG_SLUG as R,MediaTypes as j}from"../constants.js";import{JsonPointer as $}from"./JsonPointer.js";import{joinWithSeparator as _}from"../services/index.js";import{tryDecodeURIComponent as F}from"./string.js";import{getUrlDirname as U}from"./url.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 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?_(R,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const
|
|
1
|
+
import{dirname as y}from"path";import f from"url-template";import{IS_BROWSER as M}from"@redocly/theme/core/openapi";import{deleteEmptyArrayItem as E,isArrayOfObjects as T,isNumeric as S,removeQueryStringAndHash as z,resolveUrl as D,sanitizeItemId as m,normalizeText as b,getValueFromMdParsedExtension as g,isAbsoluteUrl as N}from"./helpers.js";import{DEFAULT_TAG_SLUG as R,MediaTypes as j}from"../constants.js";import{JsonPointer as $}from"./JsonPointer.js";import{joinWithSeparator as _}from"../services/index.js";import{tryDecodeURIComponent as F}from"./string.js";import{getUrlDirname as U}from"./url.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 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?_(R,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const A={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};function ae(e){if(e.type!==void 0&&!Array.isArray(e.type))return e.type;const r=Object.keys(A);for(const t of r){const n=A[t];if(e[t]!==void 0)return n}return"any"}function 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 h(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 w(e,r){const t=e?"*":"",n="__redoc_param_name__",i=f.parse(`{${n}${t}}`);return F(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 h(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"),""):h(o,e);case"simple":return w(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return T(n)&&(n=E(n).map(o=>i(o))),i(n)}function C(e,r,t){switch(e){case"simple":return w(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 O(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 O(r,o);case"cookie":case"query":return`${t}=${O(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={};if(!Array.isArray(t))return[];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?z((()=>{if(!M)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?y(i):i})()):N(e)?U(e):y(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?D(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-hideReplay":!0,"x-feedback":!0,"x-badges":!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 he(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function we(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,we 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,he as pluralizeType,de as serializeParameterValue,O as serializeParameterValueWithMime,H as serializeQueryParameter,Pe as shortenHTTPVerb,je as sortByDeprecated,ge as sortByRequired,me as urlFormEncodePayload};
|
package/lib/utils/string.js
CHANGED
|
@@ -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
|
|
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 u(e){return e.replace(/%2e|%5b|%5d/g,r=>({"%2e":".","%5b":"[","%5d":"]"})[r]||"")}function p(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 l(e){return t(e).slice(0,240)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"").slice(0,240)}function s(e,r={}){try{return JSON.parse(e)}catch{return r}}export{p as encodeBackSlashes,c as escapeFormId,a as removePercentChart,s as safeJsonParse,l as safeSlugify,o as strikethroughText,i as tryDecodeURIComponent,u as unescapeFormId};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.12.0-
|
|
3
|
+
"version": "3.12.0-rc.10",
|
|
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": "
|
|
24
|
+
"@redocly/openapi-core": "0.0.0-snapshot.1753015287",
|
|
25
25
|
"deepmerge": "^4.2.2",
|
|
26
26
|
"dompurify": "3.2.6",
|
|
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/
|
|
40
|
-
"@redocly/
|
|
39
|
+
"@redocly/replay": "0.15.0-rc.3",
|
|
40
|
+
"@redocly/config": "0.26.3-rc.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typescript": "5.6.2",
|
|
75
75
|
"url": "~0.11.0",
|
|
76
76
|
"vite": "^6.3.5",
|
|
77
|
-
"@redocly/theme": "0.56.0-
|
|
77
|
+
"@redocly/theme": "0.56.0-rc.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"start": "npm run copy-highlight-hook && vite",
|