@redocly/openapi-docs 3.16.0-next.6 → 3.16.0-next.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as E,Fragment as h,jsxs as u}from"react/jsx-runtime";import{memo as O}from"react";import{useAtom as g}from"jotai";import{ExampleSwitch as v,useExampleKey as K}from"../Samples/index.js";import{useActivateExample as j,useTelemetry as C}from"../../hooks/index.js";import{operationStore as P}from"../../jotai/operation.js";function b({mediaType:e,mediaContent:m,renderSample:a}){const l=C(),p=e.operation.pointer,[n,x]=g(P(p)),s=e.examples||e.formExamples||{},t=Object.keys(s),i=j(m),{exampleKey:c}=K(e.operation,s),r=t[n.activeOneOf[e?.examplesPointer||e.operation.pointer]]||c;return!t.length||t.length===1?a():u(h,{children:[E(v,{examples:s,exampleKey:r,onChange:o=>{const f=e.examplesPointer&&e.examplesPointer.startsWith(e.operation.pointer)?e.examplesPointer:e.operation.pointer;l.sendExamplesSwitcherClickedMessage({exampleNumber:t.indexOf(o),totalExamples:t.length}),x({...n,activeExampleName:o,activeOneOf:{...n.activeOneOf,[f]:t.indexOf(o)},requestValues:{body:null}}),i(o)}}),a(r)]})}const M=O(b);export{M as Example};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as m,jsx as n}from"react/jsx-runtime";import{memo as g}from"react";import{useAtom as y}from"jotai";import{StyledBadge as I,SelectionTitle as b}from"../common/index.js";import{Markdown as j}from"../Markdown/index.js";import{ConstraintsView as C}from"../common/ConstraintsView.js";import{Schema as T}from"./Schema.js";import{operationStore as w}from"../../jotai/operation.js";import{SchemaSelection as E}from"../common/SchemaSelection/index.js";import{useOneOfLocationIdx as N}from"./useOneOfLocationIdx.js";import{useTranslate as P}from"../../hooks/index.js";import{styled as l}from"../../styled-components.js";function z({schema:{oneOf:i},schema:e,onChange:f,oneOfLevel:a=1,...x}){const O=P(),[r,u]=y(w(e.operationPointer)),p=N(i,a),s=i.map((t,S)=>({label:t.title||t.typePrefix+t.displayType,value:S})),c=s.findIndex(t=>t.label===r.activeExampleName),d=p===-1?c!==-1?c:0:p,v=r.activeOneOf?.[e.pointer]!==void 0?r.activeOneOf[e.pointer]:d,o=i[v];if(!o)return null;const h=t=>{f?.({pointer:e.pointer,index:t}),u({activeExampleName:e.oneOf?.[t]?.title,activeOneOf:{[e.pointer]:t},requestValues:{body:null}})};return m(L,{children:[m(b,{children:[e.oneOfType,":"]}),n(E,{options:s,onChange:h,pointer:e.operationPointer,schema:e,defaultOneOfIdx:d}),o.deprecated&&n(I,{deprecated:!0,children:O("openapi.badges.deprecated","Deprecated")}),o.description&&n(D,{source:o.description}),n(C,{constraints:o.constraints}),n(T,{...x,schema:o,oneOfLevel:a+1})]})}const K=g(z),D=l(j)`
|
|
2
2
|
margin-top: var(--spacing-xs);
|
|
3
3
|
font-size: var(--font-size-base);
|
|
4
4
|
line-height: var(--line-height-base);
|
|
5
|
-
`,
|
|
5
|
+
`,L=l.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
align-items: flex-start;
|
|
9
9
|
width: 100%;
|
|
10
|
-
`;export{
|
|
10
|
+
`;export{K as OneOfSchema};
|
package/lib/models/mediaType.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getSchema as E}from"./schema.js";import{isFormUrlEncoded as
|
|
1
|
+
import{getSchema as E}from"./schema.js";import{isFormUrlEncoded as b,isJsonLike as j,isXmlLike as k,isMultipartFormData as D,JsonPointer as M,mapValues as R}from"../utils/index.js";import{getExamples as r}from"./example.js";import{safeSample as v}from"../services/code-samples/index.js";function P({parser:t,info:{encoding:e,schema:m},schema:l,mime:s,options:{isRequestType:a,onlyRequiredInSamples:p,generatedSamplesMaxDepth:u,format:d="json"}}){const f={skipReadOnly:a,skipWriteOnly:!a,skipNonRequired:a&&p,maxSampleDepth:u,quiet:!0,format:d};let n={};if(l&&l.oneOf)for(const o of l.oneOf){const i=v(o.rawSchema,f,t.definition);i!==null&&(l.discriminatorProp&&typeof i=="object"&&i&&i[l.discriminatorProp]&&!o.isDefaultMapping&&(i[l.discriminatorProp]=o.title),n[o.title]=r({parser:t,infoOrRef:{value:i},mime:s,encoding:e}))}else if(l){const o=v(m,f,t.definition);o!==null?n={default:r({parser:t,infoOrRef:{value:o},mime:s,encoding:e})}:n={default:{value:null,rawValue:"null"}}}else n={default:{value:null,rawValue:"null"}};return n}function L(t,e,m,l,s,{operation:a,type:p,response:u,absolutePointer:d=""}){let f,n,o;const i=l.schema&&E({parser:t,schemaOrRef:l.schema,pointer:"",absolutePointer:M.join(d,["content",e,"schema"]),options:s,deps:{operation:a,type:p,response:u}}),{onlyRequiredInSamples:c,generatedSamplesMaxDepth:x}=s,{encoding:O,examples:S,example:g}=l;return s.unstable_skipSamples||(S!==void 0?f=R(S,h=>r({parser:t,infoOrRef:h,mime:e,encoding:O})):g!==void 0?f={default:r({parser:t,infoOrRef:{value:t.deref(g).resolved},mime:e,encoding:O})}:j(e)||k(e)?(f=P({parser:t,info:l,schema:i,mime:e,options:{isRequestType:m,onlyRequiredInSamples:c,generatedSamplesMaxDepth:x,format:k(e)?"xml":"json"}}),o=i?.pointer):(b(e)||D(e))&&(o=i?.pointer,n=P({parser:t,info:l,schema:i,mime:e,options:{isRequestType:m,onlyRequiredInSamples:c,generatedSamplesMaxDepth:x}}))),{examples:f,schema:i,examplesPointer:o,name:e,isRequestType:m,formExamples:n,onlyRequiredInSamples:c,operation:a}}export{L as getMediaType};
|
package/lib/models/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.16.0-next.
|
|
3
|
+
"version": "3.16.0-next.8",
|
|
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.
|
|
24
|
+
"@redocly/openapi-core": "2.12.1",
|
|
25
25
|
"deepmerge": "^4.2.2",
|
|
26
26
|
"dompurify": "3.2.7",
|
|
27
27
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.40.0",
|
|
40
|
-
"@redocly/replay": "0.19.0-next.
|
|
40
|
+
"@redocly/replay": "0.19.0-next.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"tsx": "4.20.3",
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
|
-
"vite": "7.1.
|
|
77
|
+
"vite": "7.1.11",
|
|
78
78
|
"@redocly/theme": "0.60.0-next.5"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|