@redocly/openapi-docs 3.18.0-next.6 → 3.18.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 +2434 -2166
- package/lib/components/Callbacks/CallbackDetails.js +2 -2
- package/lib/components/OperationItem/OperationItem.js +10 -6
- package/lib/components/Request/RequestDetails.js +8 -2
- package/lib/components/Responses/OperationResponseList.js +2 -1
- package/lib/components/Responses/styled.js +4 -2
- package/lib/components/SchemaDefinition/SchemaDefinition.js +5 -2
- package/lib/components/SectionContent/SectionContent.js +7 -5
- package/lib/components/SectionItem/SectionItem.js +1 -1
- package/lib/components/Security/OAuthScopes.d.ts +3 -3
- package/lib/components/Security/OAuthScopes.js +12 -11
- package/lib/components/Security/RequiredScopes.d.ts +6 -0
- package/lib/components/Security/RequiredScopes.js +17 -0
- package/lib/components/Security/RequiredScopesList.d.ts +14 -0
- package/lib/components/Security/RequiredScopesList.js +13 -0
- package/lib/components/Security/ScopeTagWithTooltip.d.ts +17 -0
- package/lib/components/Security/ScopeTagWithTooltip.js +33 -0
- package/lib/components/Security/SecurityButton.js +14 -14
- package/lib/components/Security/SecurityFlow.js +18 -5
- package/lib/components/TagItem/TagItem.js +50 -37
- package/lib/components/ViewNested/ViewNested.js +7 -7
- package/lib/components/common/Dropdown/Dropdown.js +14 -12
- package/lib/components/common/OperationItemTitle.js +8 -6
- package/lib/components/common/styled.js +4 -4
- package/lib/models/schema.js +2 -2
- package/lib/services/menu/tags.js +2 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -1
- package/lib/types/oauth2-types.d.ts +4 -0
- package/lib/types/oauth2-types.js +0 -0
- package/lib/types/open-api.d.ts +2 -0
- package/lib/utils/openapi.js +1 -1
- package/lib/utils/security-scope.d.ts +5 -0
- package/lib/utils/security-scope.js +1 -0
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as o,Fragment as l,jsxs as
|
|
1
|
+
import{jsx as o,Fragment as l,jsxs as s}from"react/jsx-runtime";import{css as d}from"styled-components";import{memo as w,useEffect as $,useState as j}from"react";import{isUndefined as C}from"@redocly/theme/core/openapi";import{cycleColorsByLevel as N}from"../PropertyDetails/cycleColorsByLevel.js";import{CircleIcon as S}from"../PropertyDetails/PlusCircleIcon.js";import{LabelValue as V}from"../common/styled.js";import{styled as c}from"../../styled-components.js";function _({expandByDefault:e,level:g,expandable:h=!1,expandText:v,hideText:x,hideDivider:y=!1,children:i,expandedAll:t,isNestedArray:n}){const[r,p]=j((e||n)??!1);$(()=>{C(t)||p(t)},[t]);const a=r?N(g):void 0;if(!h)return i;const b=()=>{p(u=>!u)};return n?s(l,{children:[o(V,{children:"Array ["}),o(f,{$isArrayInsideArray:n,className:"view-nested-wrapper",children:o(m,{color:a,children:i})})]}):o(l,{children:s(f,{$divider:!y&&!r,className:"view-nested-wrapper",children:[s(k,{onClick:b,children:[o(S,{sign:r?"-":"+",color:a}),!r&&v,r&&(x||"")]}),r&&o(m,{color:a,children:i})]})})}const U=w(_),k=c.button`
|
|
2
2
|
background: none;
|
|
3
3
|
border: none;
|
|
4
4
|
cursor: pointer;
|
|
@@ -10,24 +10,24 @@ import{jsx as o,Fragment as l,jsxs as t}from"react/jsx-runtime";import{css as c}
|
|
|
10
10
|
font-size: var(--font-size-base);
|
|
11
11
|
font-family: var(--font-family-base);
|
|
12
12
|
line-height: var(--line-height-base);
|
|
13
|
-
margin: var(--spacing-xxs)
|
|
13
|
+
margin-top: var(--spacing-xxs);
|
|
14
14
|
width: 100%;
|
|
15
|
-
`,m=
|
|
15
|
+
`,m=c.div`
|
|
16
16
|
padding-left: var(--schema-nested-offset);
|
|
17
17
|
border-left: 1px solid ${({color:e})=>e||"var(--border-color-primary)"};
|
|
18
18
|
margin: -10px 0 0 9px;
|
|
19
|
-
${({color:e})=>e&&
|
|
19
|
+
${({color:e})=>e&&d`
|
|
20
20
|
.schema-name {
|
|
21
21
|
color: ${e};
|
|
22
22
|
}
|
|
23
23
|
`}
|
|
24
|
-
`,f=
|
|
24
|
+
`,f=c.div`
|
|
25
25
|
width: 100%;
|
|
26
|
-
${({$isArrayInsideArray:e})=>e&&
|
|
26
|
+
${({$isArrayInsideArray:e})=>e&&d`
|
|
27
27
|
padding-top: var(--schema-property-details-spacing);
|
|
28
28
|
`}
|
|
29
29
|
|
|
30
|
-
${({$divider:e})=>e&&
|
|
30
|
+
${({$divider:e})=>e&&d`
|
|
31
31
|
border-bottom: 1px solid var(--border-color-primary);
|
|
32
32
|
padding-bottom: var(--schema-property-details-spacing);
|
|
33
33
|
`}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as r,jsxs as d,Fragment as
|
|
1
|
+
import{jsx as r,jsxs as d,Fragment as u}from"react/jsx-runtime";import v,{useMemo as C,useState as I}from"react";import{Dropdown as j}from"@redocly/theme/components/Dropdown/Dropdown";import{CheckmarkIcon as M}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{DropdownMenu as z}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as T}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{Button as $}from"@redocly/theme/components/Button/Button";import{SearchIcon as A}from"@redocly/theme/icons/SearchIcon/SearchIcon";import{typedMemo as F}from"@redocly/theme/core/openapi";import{styled as o}from"../../../styled-components.js";import{useTranslate as L}from"../../../hooks/index.js";const R=7;function _({options:n,value:t,onChange:p,className:x,triggerVariant:b="outlined",triggerSize:y="small",fullWidth:l=!1}){const[c,m]=I(""),g=L(),a=n.find(e=>e.value===t),S=n.length>=R,f=C(()=>n.filter(e=>e.label?.toLowerCase().includes(c.toLowerCase())??!1),[n,c]);if(n.length===1)return r(U,{children:a?.element||a?.label});const k=e=>{m(e.target.value)},D=()=>S?d(u,{children:[r(O,{prefix:r(V,{children:r(A,{color:"var(--icon-color-additional)",onClick:e=>e.stopPropagation()})}),content:r(W,{placeholder:g("openapi.discriminator.searchPlaceholder","Search items"),onClick:e=>e.stopPropagation(),onChange:k,value:c})}),r(B,{children:f.length?f.map((e,s)=>d(v.Fragment,{children:[e.divider,r(i,{active:e.value===t,onAction:()=>p(e),suffix:e.value===t&&r(w,{}),children:r(h,{children:e.element||e.label})},e.label)]},s)):r(P,{content:g("openapi.discriminator.searchNoResults","No items found")})})]}):r(u,{children:n.map((e,s)=>d(v.Fragment,{children:[e.divider,r(i,{active:e.value===t,onAction:()=>p(e),suffix:e.value===t&&r(w,{}),children:r(h,{children:e.element||e.label})},e.label)]},s))});return r(N,{className:x,$fullWidth:l,trigger:r(E,{variant:b,size:y,type:"button",$fullWidth:l,children:r(h,{children:a?.element||a?.label})}),withArrow:!0,onClose:()=>m(""),children:r(H,{$fullWidth:l,children:D()})})}const oe=F(_),N=o(j)`
|
|
2
2
|
${({$fullWidth:n})=>n&&`
|
|
3
3
|
> div {
|
|
4
4
|
min-width: 100%;
|
|
@@ -7,21 +7,23 @@ import{jsx as r,jsxs as d,Fragment as f}from"react/jsx-runtime";import u,{useMem
|
|
|
7
7
|
`}
|
|
8
8
|
`,E=o($)`
|
|
9
9
|
${({$fullWidth:n})=>n&&`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-left);
|
|
14
|
-
color: var(--text-color-primary);
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
10
|
+
&& {
|
|
11
|
+
width: 100%;
|
|
12
|
+
justify-content: space-between;
|
|
17
13
|
background-color: var(--bg-color);
|
|
18
|
-
|
|
14
|
+
padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-left);
|
|
15
|
+
color: var(--text-color-primary);
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
&:hover {
|
|
18
|
+
background-color: var(--bg-color);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
background-color: var(--bg-color);
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
`}
|
|
24
|
-
`,
|
|
26
|
+
`,h=o.span`
|
|
25
27
|
overflow: hidden;
|
|
26
28
|
text-overflow: ellipsis;
|
|
27
29
|
white-space: nowrap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LinkIcon as
|
|
1
|
+
import{LinkIcon as e}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{H2 as t}from"@redocly/theme/components/Typography/H2";import{styled as i}from"../../styled-components.js";const n=i.h4`
|
|
2
2
|
font-size: var(--h4-font-size);
|
|
3
3
|
font-weight: var(--h4-font-weight);
|
|
4
4
|
line-height: var(--h4-line-height);
|
|
@@ -11,27 +11,29 @@ import{LinkIcon as t}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{H2 as e
|
|
|
11
11
|
position: relative;
|
|
12
12
|
|
|
13
13
|
:hover {
|
|
14
|
-
${
|
|
14
|
+
${e} {
|
|
15
15
|
opacity: 1;
|
|
16
16
|
visibility: visible;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`,l=i(
|
|
19
|
+
`,l=i(t)`
|
|
20
20
|
position: relative;
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: center;
|
|
23
23
|
gap: var(--spacing-xs);
|
|
24
24
|
flex-wrap: wrap;
|
|
25
|
+
overflow-wrap: anywhere;
|
|
26
|
+
word-break: break-word;
|
|
25
27
|
margin: 0;
|
|
26
28
|
|
|
27
29
|
:hover {
|
|
28
|
-
${
|
|
30
|
+
${e} {
|
|
29
31
|
opacity: 1;
|
|
30
32
|
visibility: visible;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
`,
|
|
35
|
+
`,p=i.div`
|
|
34
36
|
display: flex;
|
|
35
37
|
align-items: flex-start;
|
|
36
38
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom);
|
|
37
|
-
`;export{l as Heading,
|
|
39
|
+
`;export{l as Heading,p as HeadingWrapper,n as Title};
|
|
@@ -29,7 +29,7 @@ import{Tag as o}from"@redocly/theme/components/Tag/Tag";import{styled as r}from"
|
|
|
29
29
|
gap: var(--spacing-xs);
|
|
30
30
|
margin-top: var(--spacing-xs);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
&:after {
|
|
33
33
|
content: '';
|
|
34
34
|
flex: auto;
|
|
35
35
|
border-top: 1px solid var(--border-color-primary);
|
|
@@ -44,13 +44,13 @@ import{Tag as o}from"@redocly/theme/components/Tag/Tag";import{styled as r}from"
|
|
|
44
44
|
color: var(--tag-basic-content-color);
|
|
45
45
|
`,l=r(a)`
|
|
46
46
|
margin-top: 0;
|
|
47
|
-
|
|
47
|
+
width: 100%;
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
&:after {
|
|
50
50
|
content: none;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
&:before {
|
|
54
54
|
content: '';
|
|
55
55
|
flex: auto;
|
|
56
56
|
border-top: 1px solid var(--border-color-primary);
|
package/lib/models/schema.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as S}from"@redocly/config";import{isObject as I}from"@redocly/theme/core/openapi";import{pushRef as w}from"../services/OpenAPIParser.js";import{detectType as q,extractExtensions as C,getValueFromMdParsedExtension as M,humanizeConstraints as E,isNamedDefinition as h,isPrimitiveType as B,JsonPointer as A,pluralizeType as z,sortByDeprecated as L,sortByRequired as J}from"../utils/index.js";import{getField as
|
|
2
|
-
Field must be an object but got ${typeof i} at "${u}"`),{})}function K(i,n,u,l,P,f){let m=n.properties||($(n,"array")?n.prefixItems||n.items:void 0)||{};const a=n.patternProperties||{},y=n.additionalProperties||n.unevaluatedProperties,p=n.prefixItems?n.items:n.additionalItems,c=n.default||{};let s=Object.keys(m).map(r=>{const e=
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as S}from"@redocly/config";import{isObject as I}from"@redocly/theme/core/openapi";import{pushRef as w}from"../services/OpenAPIParser.js";import{detectType as q,extractExtensions as C,getValueFromMdParsedExtension as M,humanizeConstraints as E,isNamedDefinition as h,isPrimitiveType as B,JsonPointer as A,pluralizeType as z,sortByDeprecated as L,sortByRequired as J}from"../utils/index.js";import{getField as b}from"./field.js";function F({parser:i,schemaOrRef:n,pointer:u,options:l,isChild:P=!1,isDefaultMapping:f=!1,baseRefsStack:m=[],deps:a,absolutePointer:y}){const{resolved:p,refsStack:c}=i.deref(n,m,!0),s=n.$ref||u||y||"",r=w(c,s),e=i.mergeAllOf(p,s,r,n.$ref||y),O=e.type||q(e),t={operationPointer:a.operation?.pointer||y||"",schemaOrRef:n,isChild:P,isDefaultMapping:f,typePrefix:"",pointer:s,absolutePointer:y,refsStack:r,rawSchema:p,type:O,isCircular:!!e["x-circular-ref"],isComplex:!!e["x-complex"],title:e.title||h(s)&&A.baseName(s)||"",description:M(e,"description")||"",format:e.format,enum:e.enum||[],example:e.example,deprecated:!!e.deprecated,pattern:e.pattern,externalDocs:e.externalDocs,displayFormat:e.format,isPrimitive:B(e,O),constraints:E(e),default:e.default,readOnly:!!e.readOnly,writeOnly:!!e.writeOnly,const:e.const||"",contentEncoding:e.contentEncoding,contentMediaType:e.contentMediaType,minItems:e.minItems,maxItems:e.maxItems,nullable:e.nullable||e["x-nullable"],schema:e,displayType:"",items:void 0,extensions:void 0,oneOfType:"",discriminatorProp:void 0,oneOf:void 0,[S]:e[S],"x-enumDescriptions":M(e,"x-enumDescriptions"),get fields(){if(!t.isCircular&&!t.isComplex&&($(t,"object")||$(t,"array")&&v(e)))return K(i,e,s,l,r,a)}};if((e.nullable||e["x-nullable"])&&(Array.isArray(t.type)&&!t.type.some(d=>d===null||d==="null")?t.type=[...t.type,"null"]:!Array.isArray(t.type)&&(t.type!==null||t.type!=="null")&&(t.type=[t.type,"null"])),t.displayType=Array.isArray(t.type)?t.type.map(d=>d===null?"null":d).join(" or "):t.type,t.isCircular)return t;if(e.if&&e.then||e.if&&e.else){const{oneOf:d,oneOfType:o}=_({schema:e,parser:i,pointer:s,options:l,deps:a,refsStack:r});return t.oneOf=d,t.oneOfType=o,t}if(!P&&j(e)!==void 0){const{oneOf:d,discriminatorProp:o}=V({schema:e,parser:i,deps:a,mergedSchema:e,options:l,pointer:s,refsStack:r});return t.oneOf=d,t.discriminatorProp=o,t}else P&&Array.isArray(e.oneOf)&&e.oneOf.find(d=>d.$ref===s)&&delete e.oneOf;if(e.oneOf!==void 0){const{oneOf:d,displayType:o}=k({schemaOneOf:e.oneOf,parser:i,deps:a,options:l,pointer:s,refsStack:r,schema:e});return t.oneOfType="One of",d&&(t.oneOf=d),t.displayType=o,e.anyOf!==void 0&&console.warn(`oneOf and anyOf are not supported on the same level. Skipping anyOf at ${s}`),t}if(e.anyOf!==void 0){const{oneOf:d,displayType:o}=k({schemaOneOf:e.anyOf,parser:i,deps:a,options:l,pointer:s,refsStack:r,schema:e});return d&&(t.oneOf=d),t.displayType=o,t.oneOfType="Any of",t}if($(t,"array")&&(e.items&&!v(e)&&(t.items=F({parser:i,schemaOrRef:e.items,pointer:s+"/items",options:l,baseRefsStack:r,deps:a,absolutePointer:A.join(e.absolutePointer||"",["items"])})),t.displayType=e.prefixItems||Array.isArray(e.items)?"items":z(t.items?.displayType||t.displayType),t.displayFormat=t.items?.format||"",t.typePrefix=t.items?.typePrefix||"Array of ",t.title=t.title||t.items?.title||"",t.isPrimitive=t.items?.isPrimitive!==void 0?t.items?.isPrimitive:t.isPrimitive,t.example===void 0&&t.items?.example!==void 0&&(t.example=[t.items.example]),t.items?.isPrimitive&&(t.enum=t.items.enum,t["x-enumDescriptions"]=M(t.items,"x-enumDescriptions")),Array.isArray(t.type))){const d=t.type.filter(o=>o!=="array");d.length&&(t.displayType+=` or ${d.join(" or ")}`)}return l.showExtensions&&(t.extensions=C(e,l.showExtensions)),t}function V({schema:i,parser:n,pointer:u,options:l,refsStack:P,deps:f,mergedSchema:m}){const a=j(i),y=a?.propertyName,p=n.findDerived([...m["x-parentRefs"]||[],u]);if(i.oneOf)for(const o of i.oneOf){if(o.$ref===void 0)continue;const x=A.baseName(o.$ref);p[o.$ref]=x}const c=a?.mapping||{},s=a?.["x-explicitMappingOnly"]??Object.keys(c).length>0,r={};for(const o in c){const x=c[o];Array.isArray(r[x])?r[x].push(o):r[x]=[o]}const e=s?{...r}:{...p,...r};let O=[];for(const o of Object.keys(e)){const x=e[o];if(Array.isArray(x))for(const g of x)O.push({$ref:o,name:g});else O.push({$ref:o,name:x})}if(a?.defaultMapping){const o=O.findIndex(g=>g.name===A.baseName(a.defaultMapping)),x="Default mapping";~o?O[o]={$ref:a.defaultMapping,name:x,isDefaultMapping:!0}:O.push({$ref:a.defaultMapping,name:x,isDefaultMapping:!0})}const t=Object.keys(c);return t.length!==0&&(O=O.sort((o,x)=>{if(o.isDefaultMapping&&!x.isDefaultMapping)return 1;if(!o.isDefaultMapping&&x.isDefaultMapping)return-1;const g=t.indexOf(o.name),T=t.indexOf(x.name);return g<0&&T<0?o.name.localeCompare(x.name):g<0?1:T<0?-1:g-T})),{oneOf:O.map(({$ref:o,name:x,isDefaultMapping:g},T)=>{const D=F({parser:n,schemaOrRef:{$ref:o},pointer:o,options:l,isChild:!0,isDefaultMapping:g,baseRefsStack:P.slice(0,-1),deps:{...f,parentFieldFullPath:f.parentFieldFullPath?f.parentFieldFullPath+"&d="+T:"&d="+T.toString()},absolutePointer:m.absolutePointer});return D.title=x,D}),discriminatorProp:y}}function k({schemaOneOf:i,parser:n,refsStack:u,pointer:l,schema:P,options:f,deps:m}){const a=i.map((p,c)=>{const{resolved:s,refsStack:r}=n.deref(p,u,!0),e=n.mergeAllOf(s,l+"/oneOf/"+c,r),O=h(p.$ref)&&!e.title?A.baseName(p.$ref):`${e.title||""}${e.const&&JSON.stringify(e.const)||""}`;return F({parser:n,schemaOrRef:{...e,title:O,allOf:[{...P,oneOf:void 0,anyOf:void 0}],discriminator:s.allOf?void 0:e.discriminator},pointer:p.$ref||l+"/oneOf/"+c,options:f,baseRefsStack:r,deps:{...m,parentFieldFullPath:m.parentFieldFullPath?m.parentFieldFullPath+"&oneOf="+c:"&oneOf="+c.toString()}})}),y=[...new Set(a.map(p=>{let c=p.typePrefix+(p.title&&!f.hideSchemaTitles?`${p.title} (${p.displayType})`:p.displayType);return c.indexOf(" or ")>-1&&(c=`(${c})`),c}))].join(" or ");return{oneOf:a,displayType:y}}function _({schema:i,parser:n,pointer:u,options:l,refsStack:P,deps:f}){const{if:m,else:a={},then:y={},...p}=i;return{oneOf:[{allOf:[p,y,m],title:m&&m["x-displayName"]||m?.title||"case 1"},{allOf:[p,a],title:a&&a["x-displayName"]||a?.title||"case 2"}].map((e,O)=>F({parser:n,schemaOrRef:{...e},pointer:u+"/oneOf/"+O,options:l,baseRefsStack:P,deps:{...f,parentFieldFullPath:f.parentFieldFullPath?f.parentFieldFullPath+"&oneOf="+O:"&oneOf="+O.toString()}})),oneOfType:"One of"}}function R(i,n,u){return i||(console.warn(`Field "${n}" is invalid, skipping.
|
|
2
|
+
Field must be an object but got ${typeof i} at "${u}"`),{})}function K(i,n,u,l,P,f){let m=n.properties||($(n,"array")?n.prefixItems||n.items:void 0)||{};const a=n.patternProperties||{},y=n.additionalProperties||n.unevaluatedProperties,p=n.prefixItems?n.items:n.additionalItems,c=n.default||{};let s=Object.keys(m).map(r=>{const e=R(m[r],r,u),O=n.required===void 0?!1:n.required.indexOf(r)>-1;return b(i,{name:n.properties?r:`[${r}]`,required:O,schema:{...e,example:n.example?.[r]||e.example,default:e.default===void 0&&c?c[r]:e.default}},u+"/properties/"+r,l,f,P,A.join(n.absolutePointer||"",["properties",r]))});return l.sortRequiredPropsFirst&&(s=J(s,n.required)),s.push(...Object.keys(a).map(r=>{const e=R(a[r],r,u);return b(i,{name:r,required:!1,schema:e,kind:"patternProperties"},`${u}/patternProperties/${r}`,l,f,P)})),(I(y)||y===!0)&&s.push(b(i,{name:(I(y)&&y["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:y===!0?{}:y,kind:"additionalProperties"},u+"/additionalProperties",l,f,P,A.join(n.absolutePointer||"",["additionalProperties"]))),s.push(...Y({parser:i,schema:p,fieldsCount:s.length,$ref:u,options:l,refsStack:P,deps:f})),L(s)}function Y({parser:i,schema:n=!1,fieldsCount:u,$ref:l,options:P,refsStack:f,deps:m}){return typeof n=="boolean"?n?[b(i,{name:`[${u}...]`,schema:{},kind:"additionalItems"},`${l}/additionalItems`,P,m,f)]:[]:Array.isArray(n)?[...n.map((a,y)=>b(i,{name:`[${u+y}]`,schema:a,kind:"additionalItems"},`${l}/additionalItems/${y}`,P,m,f))]:I(n)?[b(i,{name:`[${u}...]`,schema:n,kind:"additionalItems"},`${l}/additionalItems`,P,m,f)]:[]}function j(i){return i.discriminator||i["x-discriminator"]}function $(i,n){return i.type===n||Array.isArray(i.type)&&i.type.includes(n)}function v(i){return!!(Array.isArray(i.items)||Array.isArray(i.prefixItems))}export{F as getSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as g,GROUP_DEPTH as h}from"../../constants.js";import{getValueFromMdParsedExtension as T,isOperationName as S,JsonPointer as w,safeSlugify as k}from"../../utils/index.js";import{getOperationsItems as x}from"./operation.js";import{addMarkdownItems as
|
|
1
|
+
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as g,GROUP_DEPTH as h}from"../../constants.js";import{getValueFromMdParsedExtension as T,isOperationName as S,JsonPointer as w,safeSlugify as k}from"../../utils/index.js";import{getOperationsItems as x}from"./operation.js";import{addMarkdownItems as y}from"./markdown.js";import{joinWithSeparator as b}from"../history/helpers.js";const O=["tools","resources","prompts"];function v(r,a,n,o,s){let e;if(o===void 0?e=Object.keys(a):e=o.tags,!Array.isArray(e))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const c=e.map(t=>a[t]?(a[t].used=!0,a[t]):(console.warn(`Non-existing tag "${t}" is added to the group "${o?.name}"`),null)),i=[];for(const t of c){if(!t)continue;const f=d("tag",t,n);if(f.depth=h+1,t.name===""){const m=[...y(T(t,"description")||"",f,f.depth+1),...x(void 0,t,f.depth+1)];i.push(...m);continue}const p=A({definition:r.definition,tag:t,parent:f,schemaDefinitionsTagName:s.schemaDefinitionsTagName}),l=E(r.definition,t,f);f.items=[...p,...l,...y(T(t,"description")||"",f,f.depth+1),...x(f,t,f.depth+1)],i.push(f)}return i.filter(({name:t,items:f})=>t!==g||f.length>0)}function M(r,a,n,o,s){const e=[];for(const c of n){const i=d("group",c,a);i.depth=h,i.items=v(r,o,i,c,s),e.push(i)}return e}function A({definition:r,tag:a,parent:n,schemaDefinitionsTagName:o}){const s=o?[o]:[];return Object.entries(r.components?.schemas||{}).map(([e,c])=>{if(!(c["x-tags"]||s).includes(a.name))return null;const t=d("schema",{name:e,"x-displayName":`${c.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},n);return t.depth=n.depth+1,t}).filter(Boolean)}function E(r,a,n){const o=[];for(const s of O)if(r["x-mcp"]?.[s]){const e=P(s),c=[e];for(const i of r["x-mcp"]?.[s]||[])if((i.tags?.length?i.tags:c).includes(a.name)){const f=b(n.id,k(i.name)),p=s==="tools"?`Tool name: \`${i.name}\`
|
|
2
2
|
|
|
3
3
|
`:"",m=d(s==="tools"?"tool":s==="resources"?"rsrc":"prompt",{name:i.name,"x-displayName":i.title||i.name,description:`${p}${i.description||""}
|
|
4
|
-
{% mcp${
|
|
4
|
+
{% mcp${e.slice(0,-1)} name="${i.name}" id="${f}" /%}`,isSchema:!0,level:2},n);m.depth=n.depth+1,o.push(m)}}return o}function N(r,a){const{definition:n}=r,o={},s=n["x-webhooks"]||n.webhooks,e=n["x-mcp"];for(const c of a||[])o[c.name]={...c,operations:[]};return n.paths&&u(r,n.paths,o),s&&u(r,s,o,!0),e&&j(e,o),o}function j(r,a){for(const n of O)if(r[n])for(const o of r[n]){const s=o.tags&&o.tags.length?o.tags:[P(n)];for(const e of s){let c=a[e];c===void 0&&(c={name:e,operations:[],used:!0},a[e]=c)}}}function $(r,a,n,o,s,e,c,i){if(s.$ref){const{resolved:f}=r.deref(s);u(r,{[o]:f},e,c);return}let t=n?.tags;(!t||!t.length)&&(t=c?[g]:[""]);for(const f of t){let p=e[f];p===void 0&&(p={name:f,operations:[]},e[f]=p),!p["x-traitTag"]&&p.operations.push({...n,pathName:o,pointer:w.compile(["paths",o,a]),httpVerb:a==="x-query"?"query":a,pathParameters:s.parameters||[],pathServers:s.servers,isWebhook:!!c,isAdditionalOperation:!!i,keywords:n["x-keywords"]})}}function u(r,a,n,o){for(const s of Object.keys(a||{})){const e=a[s],c=Object.keys(e).filter(S);for(const i of c){const t=e[i];$(r,i,t,s,e,n,o)}if(e.additionalOperations)for(const[i,t]of Object.entries(e.additionalOperations))$(r,i,t,s,e,n,o,!0)}}function P(r){return r.charAt(0).toUpperCase()+r.slice(1)}export{P as capitalize,M as getTagGroupsItems,v as getTagsItems,N as getTagsWithOperations,$ as processOperation};
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./open-api.js";export*from"./security.js";export*from"./app.js";
|
|
1
|
+
export*from"./open-api.js";export*from"./security.js";export*from"./app.js";export*from"./oauth2-types.js";
|
|
File without changes
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export interface OpenAPIPath extends Partial<OpenAPIRef>, ParsedDescriptionWithS
|
|
|
77
77
|
get?: OpenAPIOperation;
|
|
78
78
|
put?: OpenAPIOperation;
|
|
79
79
|
post?: OpenAPIOperation;
|
|
80
|
+
query?: OpenAPIOperation;
|
|
81
|
+
'x-query'?: OpenAPIOperation;
|
|
80
82
|
delete?: OpenAPIOperation;
|
|
81
83
|
options?: OpenAPIOperation;
|
|
82
84
|
head?: OpenAPIOperation;
|
package/lib/utils/openapi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as b}from"path";import m from"url-template";import{deleteEmptyArrayItem as w,isArrayOfObjects as E,isNumeric as S,removeQueryStringAndHash as T,resolveUrl as N,sanitizeItemId as l,normalizeText as g,getValueFromMdParsedExtension as j,isAbsoluteUrl as z}from"./helpers.js";import{DEFAULT_TAG_SLUG as D,MediaTypes as a}from"../constants.js";import{JsonPointer as _}from"./JsonPointer.js";import{joinWithSeparator as $}from"../services/index.js";import{tryDecodeURIComponent as R}from"./string.js";import{getUrlDirname as L}from"./url.js";import{IS_BROWSER as U}from"./dom.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 q={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};function oe(e){return e in q}function ue(e){const{operationId:r,pathName:t}=e,n=g(j(e,"description"));return g(j(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function se(e,r){return r?.id?$(r.id,l(e.operationId?e.operationId:d(e.pointer))).toLowerCase():e.tags?.length?l(e.operationId?e.operationId:d(e.pointer)):l(e.operationId?$(D,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const O={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(O);for(const t of r){const n=O[t];if(e[t]!==void 0)return n}return"any"}function F(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=F(e.items,e.items.type)),t)}function k(e){return e.search(/json/i)!==-1}function ce(e){return e?.search(/xml/i)!==-1}function pe(e){return e===a.URL_ENCODED}function fe(e){return e===a.MULTIPART}function me(e){return[a.JSONL,a.NDJSON,a.JSON_SEQ,a.EVENT_STREAM,a.MULTIPART_MIXED].includes(e)}function p(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 A(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 c(e,r,t){const n="__redoc_param_name__",i=r?"*":"";return m.parse(`{?${n}${i}}`).expand({[n]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function I(e,r){const t=e?"*":"",n="__redoc_param_name__",i=m.parse(`{${n}${t}}`);return R(i.expand({[n]:r}))}function le(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 c(t,o,n);case"spaceDelimited":return p(n,t,"%20");case"pipeDelimited":return p(n,t,"|");case"deepObject":return A(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 m.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 c(e,t,o);case"spaceDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style spaceDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"%20");case"pipeDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style pipeDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(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"),""):A(o,e);case"simple":return I(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return E(n)&&(n=w(n).map(o=>i(o))),i(n)}function C(e,r,t){switch(e){case"simple":return I(r,t);default:return console.warn("Unexpected style for header: "+e),""}}function J(e,r,t,n){switch(r){case"form":return c(e,t,n);default:return console.warn("Unexpected style for cookie: "+r),""}}function M(e,r){return k(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 M(r,o);case"cookie":case"query":return`${t}=${M(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 J(t,n,i,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function xe(e){return e.search(/xml/i)!==-1?"xml":e.includes("application/json-seq")?"json-seq":e.includes("application/jsonl")?"jsonl":e.includes("json")?"json":e.includes("multipart/mixed")?"multipart-mixed":e.includes("text/event-stream")?"yaml":"clike"}const h=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function ye(e){return h.test(e||"")}function be(e){return e?.match(h)?.pop()}function B(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 x(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 G(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 ge(e){const r=[],t=x("characters",e.minLength,e.maxLength);t!==void 0&&r.push(t);const n=x("items",e.minItems,e.maxItems);n!==void 0&&r.push(n);const i=x(e.minProperties===1&&e.maxProperties===1?"property":"properties",e.minProperties,e.maxProperties);i!==void 0&&r.push(i);const o=B(e.multipleOf);o!==void 0&&r.push(o);const s=G(e);return s!==void 0&&r.push(s),e.uniqueItems&&r.push("unique"),r}function je(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 _e(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function $e(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};t.forEach(u=>{({resolved:u}=e.deref(u)),o[u.name+"_"+u.in]=!0});const s=r.map((u,f)=>({paramOrRef:u,pointer:_.join(n,["parameters",String(f)])})).filter(({paramOrRef:u})=>({resolved:u}=e.deref(u),!o[u.name+"_"+u.in])),y=t.map((u,f)=>({paramOrRef:u,pointer:_.join(i,["parameters",String(f)])}));return[...s,...y]}function Pe(e,r){const n=e===void 0?T((()=>{if(!U)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?b(i):i})()):z(e)?L(e):b(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?N(n,i.url):i.url,description:i.description||""}))}const Oe=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-badges":!0,"x-hideReplay":!0,"x-feedback":!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 Ie(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function Me(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,Me as getContentWithLegacyExamples,be as getDefinitionName,se as getOperationId,ue as getOperationName,ie as getStatusCodeType,ge as humanizeConstraints,G as humanizeNumberRange,pe as isFormUrlEncoded,k as isJsonLike,fe as isMultipartFormData,ye as isNamedDefinition,oe as isOperationName,F as isPrimitiveType,Q as isRedocExtension,me as isSequentialMediaType,ne as isStatusCode,ce as isXmlLike,xe as langFromMime,$e as mergeParams,Pe as normalizeServers,Ie as pluralizeType,de as serializeParameterValue,M as serializeParameterValueWithMime,H as serializeQueryParameter,Oe as shortenHTTPVerb,_e as sortByDeprecated,je as sortByRequired,le as urlFormEncodePayload};
|
|
1
|
+
import{dirname as b}from"path";import m from"url-template";import{deleteEmptyArrayItem as w,isArrayOfObjects as E,isNumeric as S,removeQueryStringAndHash as T,resolveUrl as N,sanitizeItemId as l,normalizeText as g,getValueFromMdParsedExtension as j,isAbsoluteUrl as z}from"./helpers.js";import{DEFAULT_TAG_SLUG as D,MediaTypes as a}from"../constants.js";import{JsonPointer as _}from"./JsonPointer.js";import{joinWithSeparator as $}from"../services/index.js";import{tryDecodeURIComponent as R}from"./string.js";import{getUrlDirname as q}from"./url.js";import{IS_BROWSER as L}from"./dom.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 U={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0,"x-query":!0,query:!0};function oe(e){return e in U}function ue(e){const{operationId:r,pathName:t}=e,n=g(j(e,"description"));return g(j(e,"summary"))||r||n&&n.substring(0,50)||t||"<no summary>"}function se(e,r){return r?.id?$(r.id,l(e.operationId?e.operationId:d(e.pointer))).toLowerCase():e.tags?.length?l(e.operationId?e.operationId:d(e.pointer)):l(e.operationId?$(D,e.operationId):d(e.pointer))}function d(e){return e?.startsWith("/")?e.slice(1,e.length):e}const O={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(O);for(const t of r){const n=O[t];if(e[t]!==void 0)return n}return"any"}function F(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=F(e.items,e.items.type)),t)}function k(e){return e.search(/json/i)!==-1}function ce(e){return e?.search(/xml/i)!==-1}function pe(e){return e===a.URL_ENCODED}function fe(e){return e===a.MULTIPART}function me(e){return[a.JSONL,a.NDJSON,a.JSON_SEQ,a.EVENT_STREAM,a.MULTIPART_MIXED].includes(e)}function p(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 A(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 c(e,r,t){const n="__redoc_param_name__",i=r?"*":"";return m.parse(`{?${n}${i}}`).expand({[n]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function I(e,r){const t=e?"*":"",n="__redoc_param_name__",i=m.parse(`{${n}${t}}`);return R(i.expand({[n]:r}))}function le(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 c(t,o,n);case"spaceDelimited":return p(n,t,"%20");case"pipeDelimited":return p(n,t,"|");case"deepObject":return A(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 m.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 c(e,t,o);case"spaceDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style spaceDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(n,e,"%20");case"pipeDelimited":return!Array.isArray(o)&&typeof o!="object"?(console.warn("The style pipeDelimited is applicable to arrays or objects"),""):t?c(e,t,o):p(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"),""):A(o,e);case"simple":return I(t,n);default:return console.warn("Unexpected style for query: "+r),""}};return E(n)&&(n=w(n).map(o=>i(o))),i(n)}function C(e,r,t){switch(e){case"simple":return I(r,t);default:return console.warn("Unexpected style for header: "+e),""}}function J(e,r,t,n){switch(r){case"form":return c(e,t,n);default:return console.warn("Unexpected style for cookie: "+r),""}}function M(e,r){return k(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 M(r,o);case"cookie":case"query":return`${t}=${M(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 J(t,n,i,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}function xe(e){return e.search(/xml/i)!==-1?"xml":e.includes("application/json-seq")?"json-seq":e.includes("application/jsonl")?"jsonl":e.includes("json")?"json":e.includes("multipart/mixed")?"multipart-mixed":e.includes("text/event-stream")?"yaml":"clike"}const h=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;function ye(e){return h.test(e||"")}function be(e){return e?.match(h)?.pop()}function B(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 x(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 G(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 ge(e){const r=[],t=x("characters",e.minLength,e.maxLength);t!==void 0&&r.push(t);const n=x("items",e.minItems,e.maxItems);n!==void 0&&r.push(n);const i=x(e.minProperties===1&&e.maxProperties===1?"property":"properties",e.minProperties,e.maxProperties);i!==void 0&&r.push(i);const o=B(e.multipleOf);o!==void 0&&r.push(o);const s=G(e);return s!==void 0&&r.push(s),e.uniqueItems&&r.push("unique"),r}function je(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 _e(e){return e.sort((r,t)=>Number(r.deprecated)-Number(t.deprecated))}function $e(e,r=[],t=[],{pathPointer:n,operationPointer:i}){const o={};t.forEach(u=>{({resolved:u}=e.deref(u)),o[u.name+"_"+u.in]=!0});const s=r.map((u,f)=>({paramOrRef:u,pointer:_.join(n,["parameters",String(f)])})).filter(({paramOrRef:u})=>({resolved:u}=e.deref(u),!o[u.name+"_"+u.in])),y=t.map((u,f)=>({paramOrRef:u,pointer:_.join(i,["parameters",String(f)])}));return[...s,...y]}function Pe(e,r){const n=e===void 0?T((()=>{if(!L)return globalThis.SSR_HOSTNAME||"";const i=window.location.href;return i.endsWith(".html")?b(i):i})()):z(e)?q(e):b(e);return r.length===0&&(r=[{url:"/"}]),r.map(i=>({...i,url:n?N(n,i.url):i.url,description:i.description||""}))}const Oe=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-badges":!0,"x-hideReplay":!0,"x-feedback":!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 Ie(e){return e.split(" or ").map(r=>r.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")).join(" or ")}function Me(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,Me as getContentWithLegacyExamples,be as getDefinitionName,se as getOperationId,ue as getOperationName,ie as getStatusCodeType,ge as humanizeConstraints,G as humanizeNumberRange,pe as isFormUrlEncoded,k as isJsonLike,fe as isMultipartFormData,ye as isNamedDefinition,oe as isOperationName,F as isPrimitiveType,Q as isRedocExtension,me as isSequentialMediaType,ne as isStatusCode,ce as isXmlLike,xe as langFromMime,$e as mergeParams,Pe as normalizeServers,Ie as pluralizeType,de as serializeParameterValue,M as serializeParameterValueWithMime,H as serializeQueryParameter,Oe as shortenHTTPVerb,_e as sortByDeprecated,je as sortByRequired,le as urlFormEncodePayload};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OAuth2Flows } from '../types/index.js';
|
|
2
|
+
export declare function isScopeTruncated(scope: string, maxVisibleScopeChars: number): boolean;
|
|
3
|
+
export declare function getVisibleScopeLabel(scope: string, maxVisibleScopeChars: number): string;
|
|
4
|
+
export declare function normalizeScopes(scopes?: string[]): string[];
|
|
5
|
+
export declare function buildScopeDescriptionIndex(flows?: OAuth2Flows): Map<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(e,t){return e.length>t}function c(e,t){return o(e,t)?`${e.slice(0,t)}...`:e}function f(e){return!e||e.length===0?[]:e.flatMap(t=>t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean))}function u(e){const t=new Map;if(!e)return t;for(const n of Object.values(e))if(n?.scopes)for(const[r,i]of Object.entries(n.scopes))t.has(r)||t.set(r,i);return t}export{u as buildScopeDescriptionIndex,c as getVisibleScopeLabel,o as isScopeTruncated,f as normalizeScopes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.18.0-next.
|
|
3
|
+
"version": "3.18.0-next.7",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url-template": "^2.0.8",
|
|
39
39
|
"util": "~0.12.5",
|
|
40
40
|
"web-vitals": "3.3.1",
|
|
41
|
-
"@redocly/config": "0.41.
|
|
42
|
-
"@redocly/replay": "0.21.0-next.
|
|
41
|
+
"@redocly/config": "0.41.4",
|
|
42
|
+
"@redocly/replay": "0.21.0-next.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@shikijs/transformers": "3.21.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"url": "~0.11.0",
|
|
73
73
|
"vite": "7.2.6",
|
|
74
74
|
"vitest": "4.0.10",
|
|
75
|
-
"@redocly/theme": "0.62.0-next.
|
|
75
|
+
"@redocly/theme": "0.62.0-next.5"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"start": "pnpm run copy-highlight-hook && vite",
|