@redocly/openapi-docs 3.14.0-next.5 → 3.14.0-next.7
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 +1890 -1813
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/OperationItem/OperationItem.js +4 -4
- package/lib/components/SchemaCatalogLink/SchemaCatalogLink.d.ts +5 -0
- package/lib/components/SchemaCatalogLink/SchemaCatalogLink.js +36 -0
- package/lib/components/SchemaCatalogLink/tests/SchemaCatalogLink.test.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/tests/SchemaCatalogLink.test.js +1 -0
- package/lib/components/SchemaDefinition/SchemaDefinition.js +4 -2
- package/lib/services/code-samples/httpsnippet/targets/php/utils.js +2 -2
- package/lib/types/open-api.d.ts +2 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t,jsxs as l,Fragment as f}from"react/jsx-runtime";import{memo as u,useMemo as p}from"react";import{Navigate as c,Route as n,Routes as m}from"react-router-dom";import{getFirstPageLink as d,getItemsByType as g}from"./helpers.js";import{SectionContent as s}from"../SectionContent/index.js";function h({items:e,root:r=!1}){const{rootItem:o}=g(e),a=!r||o?"/":d(e,"/"),i=p(()=>l(m,{children:[o&&t(n,{path:`${o.href||"/"}*`,element:t(s,{items:e})}),t(n,{path:"*",element:t(c,{to:a,replace:!0})})]}),[o,"/",e,a]);return r&&!e.length?t(m,{children:t(n,{path:"*",element:t(s,{items:e})})}):e.length?t(f,{children:i}):null}const I=u(h);export{I as ContentItems};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K,useState as F,useCallback as
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K,useState as F,useCallback as L,useMemo as j}from"react";import{useAtomValue as g}from"jotai";import{LayoutVariant as $}from"@redocly/config";import{AfterOpenApiOperation as z}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation";import{BeforeOpenApiOperation as G}from"@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation";import{PageActions as J}from"@redocly/theme/components/PageActions/PageActions";import{Feedback as Q}from"@redocly/theme/components/Feedback/Feedback";import{SamplesMiddlePanel as s,SamplesPanel as U,ShareLink as X,Row as W,CustomBadges as Y}from"../common/index.js";import{CallbacksList as Z}from"../Callbacks/index.js";import{CallbackSamples as ee}from"../CallbackSamples/index.js";import{RequestSamples as ae}from"../RequestSamples/index.js";import{OperationResponseList as te}from"../Responses/index.js";import{ResponseSamples as oe}from"../ResponseSamples/index.js";import{makeDeepLink as ne,joinWithSeparator as se}from"../../services/index.js";import{layoutAtom as re,userClaimsAtom as ie}from"../../jotai/app.js";import{globalOptionsAtom as le,globalStoreAtom as ce}from"../../jotai/store.js";import{getOperation as pe}from"../../models/operation.js";import{RenderHook as B}from"../RenderHook/index.js";import{Heading as de,HeadingWrapper as me,Title as ge}from"../common/OperationItemTitle.js";import{LinkToField as ke}from"../common/LinkToField.js";import{RequestDetails as he}from"../Request/RequestDetails.js";import{StyledBadge as H}from"../common/Badges.js";import{useTranslate as ue}from"../../hooks/index.js";import{styled as k}from"../../styled-components.js";import{createPanelToggleEvent as be}from"../../events/index.js";import{SchemaCatalogLink as fe}from"../SchemaCatalogLink/SchemaCatalogLink.js";function Se({item:{operationDefinition:S,parent:v,href:h}}){const r=ue(),{parser:y,options:l}=g(ce),{events:x}=g(le),T=g(ie),n=g(re),[c,I]=F(),{unstable_hooks:C,feedback:p}=l,a=j(()=>pe(y,S,v,l,h,void 0,T),[h,S,l,v,y,T]),{name:O,deprecated:_,isWebhook:q,badges:D}=a||{},o=n===$.STACKED,R=p?.type||"sentiment",A=p?.hide!==!0,u=se(l.routingBasePath,a.href),[b,E]=F(null),P=L(m=>{c!==m&&I(m)},[c]),d=L((m,w)=>{if(!w)return;const N=be({operation:a,isExpanded:m,panelType:w});x?.panelToggle?.(N)},[x,a]),M=j(()=>A?e(ve,{children:e(Q,{type:R,settings:p.settings,path:u})}):null,[A,R,p.settings,u]);return t(ye,{layout:n,children:[e(i,{layout:n,children:t(s,{isStacked:o,children:[e(B,{Hook:G||C?.BeforeOperation,props:{operation:a}}),t(me,{children:[t(de,{"data-testid":"operation-item-header",children:[e(X,{to:h,"aria-label":`link to ${O}`}),e(Y,{badges:D,children:O}),_&&e(H,{deprecated:!0,children:r("openapi.badges.deprecated","Deprecated")}),q&&e(H,{children:r("openapi.badges.webhook","Webhook")})]}),e(J,{pageSlug:u})]})]})}),e(s,{isStacked:o,children:e(fe,{schemaRef:"#"+a.pointer})}),t(i,{layout:n,children:[e(s,{isStacked:o,children:e(he,{operation:a,translate:r,onPanelToggle:d})}),e(f,{isStacked:o,"data-testid":"samples-block",className:"panel-container-request-samples",children:e(ae,{operation:a,onPanelToggle:d})})]}),t(i,{layout:n,children:[e(s,{isStacked:o,children:a.responses?.length?e(te,{responses:a.responses,operationId:a.id,operationPointer:a.pointer,callbackId:a.callbackId,activeResponseTab:c,onTabChange:P,onPanelToggle:d}):null}),e(f,{isStacked:o,"data-testid":"samples-block",className:"panel-container-response-samples",children:e(oe,{operation:a,activeResponseTab:c,onTabChange:P,onPanelToggle:d})})]}),t(i,{layout:n,children:[t(s,{isStacked:o,children:[a.callbacks?.length?t(V,{children:[t(ge,{children:[e(ke,{to:ne(a.id,"callbacks")}),r("openapi.callbacks","Callbacks")]}),e(Z,{callbacks:a.callbacks,onExpand:E,selectedCallback:b})]}):null,e(B,{Hook:z||C?.AfterOperation,props:{operation:a}})]}),b?e(f,{isStacked:o,"data-testid":"samples-block",children:e(ee,{callback:b,translate:r})}):null]}),e(i,{layout:n,children:e(s,{isStacked:o,fullWidth:!0,children:M})})]})}const Qe=K(Se),f=k(U)`
|
|
2
2
|
margin-left: auto;
|
|
3
3
|
--code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) 20px;
|
|
4
|
-
`,
|
|
4
|
+
`,ve=k.div`
|
|
5
5
|
& > div {
|
|
6
6
|
flex: 1 1 auto;
|
|
7
7
|
display: flex;
|
|
@@ -12,10 +12,10 @@ import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K
|
|
|
12
12
|
width: 100%;
|
|
13
13
|
max-width: var(--feedback-width);
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,ye=k(W)`
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
align-items: flex-start;
|
|
18
18
|
padding: var(--spacing-base) 0 calc(var(--spacing-xl) + var(--spacing-xs));
|
|
19
19
|
`,i=k(W)`
|
|
20
20
|
margin: calc(var(--spacing-unit) * 2) 0;
|
|
21
|
-
`;export{
|
|
21
|
+
`;export{Qe as OperationItem,f as OperationSamplesPanel};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{jsx as o,jsxs as p}from"react/jsx-runtime";import{useAtomValue as b}from"jotai";import{useState as d}from"react";import{Button as C}from"@redocly/theme/components/Button/Button";import{CopyLinkIcon as T}from"@redocly/theme/icons/CopyLinkIcon/CopyLinkIcon";import{ShareIcon as w}from"@redocly/theme/icons/ShareIcon/ShareIcon";import{ClipboardService as S}from"@redocly/theme/core/openapi";import{Tooltip as r}from"@redocly/theme/components/Tooltip/Tooltip";import{styled as t}from"../../styled-components.js";import{IS_BROWSER as L}from"../../utils/dom.js";import{globalStoreAtom as y}from"../../jotai/store.js";import{useTranslate as O}from"../../hooks/index.js";function J({schemaRef:m}){const{parser:h}=b(y),[n,l]=d("idle"),[g,c]=d(void 0),i=O(),s=h.definition["x-schema-catalog-link"];if(!s)return null;const e=L?window.location.origin:globalThis.SSR_HOSTNAME||"http://127.0.0.1:4000",a=s+m,k=e+a,u=n==="copied"?i("openapi.schemaCatalogLink.copiedTooltip","Copied!"):i("openapi.schemaCatalogLink.copyButtonTooltip","Copy to clipboard"),f=n==="copied"?!0:void 0,v=()=>{S.copyCustom(k),l("copied"),clearTimeout(g);const x=setTimeout(()=>{l("idle"),c(void 0)},1e3);c(x)};return p(j,{children:[o(r,{tip:i("openapi.schemaCatalogLink.title","Shared schema"),placement:"bottom",children:o(I,{children:o(w,{})})}),o(B,{children:p(E,{tip:e+a,placement:"bottom",width:"380px",children:[o(_,{children:e}),o(W,{children:o(A,{dir:"ltr",children:a})})]})}),o(r,{tip:u,isOpen:f,placement:"bottom",children:o(C,{icon:o(T,{}),onClick:v})})]})}const j=t.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: var(--spacing-xs);
|
|
4
|
+
align-items: center;
|
|
5
|
+
margin-bottom: var(--schema-catalog-link-margin-bottom);
|
|
6
|
+
padding: var(--schema-catalog-link-padding);
|
|
7
|
+
border-radius: var(--schema-catalog-link-border-radius);
|
|
8
|
+
background-color: var(--schema-catalog-link-background-color);
|
|
9
|
+
`,I=t.div`
|
|
10
|
+
width: var(--schema-catalog-link-share-icon-wrapper-size);
|
|
11
|
+
height: var(--schema-catalog-link-share-icon-wrapper-size);
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
background-color: var(--schema-catalog-link-share-icon-background-color);
|
|
16
|
+
color: var(--schema-catalog-link-share-icon-color);
|
|
17
|
+
border-radius: var(--schema-catalog-link-share-icon-border-radius);
|
|
18
|
+
`,_=t.span`
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
`,W=t.span`
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
direction: rtl;
|
|
25
|
+
`,A=t.span`
|
|
26
|
+
/* Override direction so that characters like '/ or '_' do no change order in the pathname */
|
|
27
|
+
direction: ltr;
|
|
28
|
+
`,B=t.div`
|
|
29
|
+
color: var(--schema-catalog-link-text-color);
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-grow: 1;
|
|
34
|
+
`,E=t(r)`
|
|
35
|
+
max-width: 100%;
|
|
36
|
+
`;export{J as SchemaCatalogLink};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{render as s}from"@testing-library/react";import*as o from"jotai";import{SchemaCatalogLink as a}from"../SchemaCatalogLink";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn()})),describe("SchemaCatalogLink",()=>{it("should render correctly",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should not render if x-schema-catalog-link is not defined",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()})});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as
|
|
1
|
+
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as C,useCallback as k,useMemo as A}from"react";import{LayoutVariant as j}from"@redocly/config";import{useAtom as D,useAtomValue as x}from"jotai";import{useWriteAtom as T}from"../../jotai/use-write-atom.js";import{SamplesMiddlePanel as E,SamplesPanel as N,Row as P,Section as b,CodeBlockPanel as w}from"../common/index.js";import{getMediaType as I}from"../../models/index.js";import{MediaTypeSamples as L}from"../PayloadSamples/index.js";import{Schema as V}from"../Schema/index.js";import{Markdown as W}from"../Markdown/index.js";import{layoutAtom as _}from"../../jotai/app.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{operationStore as O}from"../../jotai/operation.js";import{styled as v}from"../../styled-components.js";import{SchemaCatalogLink as B}from"../SchemaCatalogLink/SchemaCatalogLink.js";const K=(t,i)=>{if(!t)return{};const a={schema:{$ref:t}};return i&&(a.examples={example:{$ref:i}}),a};function q({schemaRef:t,exampleRef:i,showReadOnly:a=!0,showWriteOnly:y=!1}){const s=x(_),{parser:c,options:p}=x($),l=T(),e=A(()=>I(c,"json",!1,K(t,i),p,{operation:{pointer:"SchemaDefinitionComponent"}}),[i,p,c,t]),[d,f]=D(O(e.operation?.pointer)),g=k(r=>{if(!e.schema)return;const n=e.schema,u=n.oneOf;if(u&&e?.examples&&Object.keys(e?.examples).includes(r)){const m=u.findIndex(M=>M.title===r);m!==-1&&n&&l(O(n.operationPointer),{activeExampleName:n.oneOf?.[m]?.title,activeOneOf:{[n.pointer]:m}})}d.activeExampleName!==r&&f({activeExampleName:r})},[e?.examples,e.schema,d.activeExampleName,f,l]),h=s===j.STACKED;return o(b,{children:S(P,{layout:s,children:[S(F,{isStacked:h,children:[t&&o(B,{schemaRef:t}),e.schema?.description&&o(z,{children:o(W,{source:e.schema?.description})}),o(V,{skipWriteOnly:!y,skipReadOnly:!a,schema:e.schema,level:1})]}),o(N,{isStacked:h,children:o(w,{className:"panel-response-samples",children:o(L,{mediaType:e,onChange:g})})})]})})}const re=C(q),z=v.div`
|
|
2
2
|
margin-bottom: var(--spacing-vertical);
|
|
3
|
-
|
|
3
|
+
`,F=v(E)`
|
|
4
|
+
padding-left: 0;
|
|
5
|
+
`;export{re as SchemaDefinition};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const h=["number","boolean","function","symbol"];function x(c){return Object.prototype.toString.call(c)==="[object RegExp]"}function j(c){const s=typeof c;return c!==null&&(s==="object"||s==="function")}function O(c,s,b=""){const i=[];return
|
|
1
|
+
const h=["number","boolean","function","symbol"];function x(c){return Object.prototype.toString.call(c)==="[object RegExp]"}function j(c){const s=typeof c;return c!==null&&(s==="object"||s==="function")}function O(c,s,b=""){const i=[];return(function y(e,r={},f=""){r.indent=r.indent||" ";const n={newLine:`
|
|
2
2
|
`,newLineOrSpace:`
|
|
3
3
|
`,pad:f,indent:f+r.indent},w=t=>{if(r.inlineCharacterLimit===void 0)return t;const l=t.replace(new RegExp(n.newLine,"g"),"").replace(new RegExp(n.newLineOrSpace,"g")," ").replace(new RegExp(n.pad+"|"+n.indent,"g"),"");return l.length<=r.inlineCharacterLimit?l:t.replace(new RegExp(n.newLine+"|"+n.newLineOrSpace,"g"),`
|
|
4
4
|
`).replace(new RegExp(n.pad,"g"),f).replace(new RegExp(n.indent,"g"),f+r.indent)};if(i.indexOf(e)!==-1)return'"Circular"';if(e===null)return"NULL";if(e===void 0||h.includes(typeof e)||x(e))return String(e);if(e instanceof Date)return`date('${e.toISOString()}')`;if(Array.isArray(e)){if(e.length===0)return"array()";i.push(e);const t="array("+n.newLine+e.map((l,a)=>{const d=e.length-1===a?n.newLine:","+n.newLineOrSpace;let g=y(l,r,f+r.indent);return r.transform&&(g=r.transform(e,a,g)),n.indent+g+d}).join("")+n.pad+")";return i.pop(),w(t)}if(j(e)){let t=Object.keys(e);if(r.filter&&(t=t.filter(a=>r.filter?.(e,a))),t.length===0)return Array.isArray(e)?"array()":"(object)[]";i.push(e);const l="array("+n.newLine+t.map((a,d)=>{const g=t.length-1===d?n.newLine:","+n.newLineOrSpace,L=typeof a=="symbol",m=!L&&/^[a-z$_][a-z$_0-9]*$/i.test(a),S=L||m?a:y(a,r);let o=y(e[a],r,f+r.indent);return r.transform&&(o=r.transform(e,a,o)),`${n.indent}"${String(S)}" => ${o}${g}`}).join("")+n.pad+")";return i.pop(),w(l)}return e=String(e).replace(/[\r\n]/g,t=>t===`
|
|
5
|
-
`?"\\n":"\\r"),r.singleQuotes===!1?(e=e.replace(/"/g,'\\"'),`"${e}"`):(e=e.replace(/\\?'/g,"\\'"),`"${e}"`)}(c,s,b)}export{O as objectToPhpArray};
|
|
5
|
+
`?"\\n":"\\r"),r.singleQuotes===!1?(e=e.replace(/"/g,'\\"'),`"${e}"`):(e=e.replace(/\\?'/g,"\\'"),`"${e}"`)})(c,s,b)}export{O as objectToPhpArray};
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Sample } from '../models';
|
|
2
|
-
import type { ENTITY_RELATION_TYPES } from '@redocly/
|
|
2
|
+
import type { ENTITY_RELATION_TYPES } from '@redocly/config';
|
|
3
3
|
export interface OpenAPIDefinition {
|
|
4
4
|
openapi: string;
|
|
5
5
|
info: OpenAPIInfo;
|
|
@@ -16,6 +16,7 @@ export interface OpenAPIDefinition {
|
|
|
16
16
|
tags: Array<string>;
|
|
17
17
|
}>;
|
|
18
18
|
'x-feedback'?: any;
|
|
19
|
+
'x-schema-catalog-link'?: string;
|
|
19
20
|
}
|
|
20
21
|
export interface OpenAPIInfo extends ParsedDescriptionWithSummary {
|
|
21
22
|
title: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.14.0-next.
|
|
3
|
+
"version": "3.14.0-next.7",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"url-template": "^2.0.8",
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
|
-
"@redocly/config": "0.
|
|
40
|
-
"@redocly/replay": "0.17.0-next.
|
|
39
|
+
"@redocly/config": "0.33.0",
|
|
40
|
+
"@redocly/replay": "0.17.0-next.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/react-dom": "^19.1.4",
|
|
55
55
|
"@types/styled-components": "5.1.34",
|
|
56
56
|
"@vitejs/plugin-react": "^4.2.1",
|
|
57
|
-
"esbuild": "0.25.
|
|
57
|
+
"esbuild": "0.25.10",
|
|
58
58
|
"jest": "29.5.0",
|
|
59
59
|
"jest-environment-jsdom": "29.5.0",
|
|
60
60
|
"jest-styled-components": "7.2.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"tsx": "4.20.3",
|
|
75
75
|
"typescript": "5.6.2",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
|
-
"vite": "
|
|
78
|
-
"@redocly/theme": "0.58.0-next.
|
|
77
|
+
"vite": "6.3.6",
|
|
78
|
+
"@redocly/theme": "0.58.0-next.5"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|