@redocly/realm 0.134.0-next.6 → 0.134.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.134.0-next.8
4
+
5
+ ### Patch Changes
6
+
7
+ - fb00f8a1283: Fixed an issue where schema fields inside `oneOf`, `anyOf`, or behind a `discriminator` weren't rendering in `llms.txt` API description pages.
8
+
9
+ ## 0.134.0-next.7
10
+
11
+ ### Patch Changes
12
+
13
+ - c57df6366d5: Fixed page navigation buttons stretching excessively on large screens.
14
+ - c9c79a6716b: Fixed security vulnerabilities `CVE-2026-47675`, `CVE-2026-47676`, `CVE-2026-47673`, `CVE-2026-47674` by upgrading `hono` to version `4.12.23`.
15
+ - Updated dependencies [c57df6366d5]
16
+ - @redocly/theme@0.66.0-next.5
17
+ - @redocly/asyncapi-docs@1.11.0-next.6
18
+ - @redocly/graphql-docs@1.11.0-next.6
19
+ - @redocly/openapi-docs@3.22.0-next.6
20
+ - @redocly/portal-plugin-mock-server@0.19.0-next.6
21
+
3
22
  ## 0.134.0-next.6
4
23
 
5
24
  ### Minor Changes
@@ -1,11 +1,14 @@
1
- import type { OpenAPIParser, ContentItemModel, OperationModel, Options, SchemaModel } from '@redocly/openapi-docs';
1
+ import type { ContentItemModel, OpenAPIParser, OperationModel, Options, SchemaModel } from '@redocly/openapi-docs';
2
2
  import type { OperationParameter } from '@redocly/theme/core/types';
3
3
  import type { SearchDocument } from '../../types';
4
4
  import { OpenApiSearchBuilder } from './openapi-search-builder.js';
5
+ type Parameters = Record<string, OperationParameter>;
5
6
  export declare class AiSearchIndexer extends OpenApiSearchBuilder {
7
+ #private;
6
8
  constructor(parser: OpenAPIParser, options: Options, basePath: string);
7
9
  addItem(item: ContentItemModel): SearchDocument | undefined;
8
10
  protected buildOperationDocument(operation: OperationModel): SearchDocument | undefined;
9
- protected addSchema(parameters: Record<string, OperationParameter>, schema: SchemaModel | undefined, mediaType: string | undefined, place: string, isResponse: boolean, path?: string[], visitedPointers?: Set<string>, level?: number): void;
11
+ protected addSchema(parameters: Parameters, schema: SchemaModel | undefined, mediaType: string | undefined, place: string, isResponse: boolean, path?: string[], visited?: Set<string>, level?: number, skipFields?: Set<string>): void;
10
12
  }
13
+ export {};
11
14
  //# sourceMappingURL=ai-search-indexer.d.ts.map
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as l}from"@redocly/config";import{OpenApiSearchBuilder as m}from"./openapi-search-builder.js";class p extends m{constructor(t,r,n){super(t,r,n)}addItem(t){try{return this.buildSearchDocument(t)}catch(r){console.error("Cannot add item to AI search indexer",r.message);return}}buildOperationDocument(t){return this.createOperationDocumentBase(t)}addSchema(t,r,n,d,i,a=[],o=new Set,u=0){if(!(!r||r.isCircular)){if(r.pointer){if(o.has(r.pointer))return;o.add(r.pointer)}if(!(u>this.options.generatedSamplesMaxDepth)){if(r.fields)for(const e of r.fields){if(r[l]||e.kind==="additionalProperties"||e.schema?.readOnly&&!i||e.schema?.writeOnly&&i)continue;const c=this.createSchemaFieldParameter(e,r,d,n,a),f=this.getParameterId(c);t[f]==null&&(t[f]=c,this.addSchema(t,e.schema,n,d,i,a.concat([e.name]),o,u+1))}r.items&&this.addSchema(t,r.items,n,d,i,a,o,u+1)}}}}export{p as AiSearchIndexer};
1
+ import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{OpenApiSearchBuilder as h}from"./openapi-search-builder.js";import{getOneOfSchema as O}from"./utils.js";class y extends h{constructor(t,e,n){super(t,e,n)}addItem(t){try{return this.buildSearchDocument(t)}catch(e){console.error("Cannot add item to AI search indexer",e.message);return}}buildOperationDocument(t){const e=this.createOperationDocumentBase(t),n=e?.parameters?.find(i=>i.place==="request fields"&&i.name==="body"&&"oneOf"in i&&i.oneOf!==void 0);return n&&(n.required=t.requestBody?.required??!1),e}addSchema(t,e,n,i,s,u=[],o=new Set,d=0,c){if(!(!e||e.isCircular||d>this.options.generatedSamplesMaxDepth)){if(e.pointer){if(o.has(e.pointer))return;o.add(e.pointer)}for(const r of e.fields??[]){if(c?.has(r.name)||this.#t(e,r,s))continue;const a=this.createSchemaFieldParameter(r,e,i,n,u),f=this.getParameterId(a);if(t[f]!=null)continue;t[f]=a,this.addSchema(t,r.schema,n,i,s,[...u,r.name],o,d+1);const l=O(r.schema);l&&(a.oneOf=this.#e(l,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1}))}if(e.items&&this.addSchema(t,e.items,n,i,s,u,o,d+1),d===0&&u.length===0&&e.oneOf){const r=this.#e(e,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1});if(r){const a={name:"body",description:"",place:i,mediaType:n,path:[],type:e.displayType||"object",required:!1,example:void 0,enum:void 0,oneOf:r};t[this.getParameterId(a)]=a}}}}#t(t,e,n){return!!t[m]||e.kind==="additionalProperties"||!!e.schema?.readOnly&&!n||!!e.schema?.writeOnly&&n}#e(t,e){const{mediaType:n,place:i,isResponse:s,visited:u,level:o}=e,d=new Set((t.fields??[]).map(r=>r.name)),c=(t.oneOf??[]).map((r,a)=>{const f={};return this.addSchema(f,r,n,i,s,[],new Set(u),o,d),{title:r.title||`variant ${a+1}`,parameters:Object.values(f)}}).filter(r=>r.parameters.length>0);if(c.length!==0)return{discriminator:t.discriminatorProp,variants:c}}}export{y as AiSearchIndexer};
@@ -1,7 +1,7 @@
1
- import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as L,join as _}from"node:path";import q from"@markdoc/markdoc";import{joinSectionContent as C}from"../../../plugins/markdown/search/join-section-content.js";import{toMarkdown as G}from"../../../plugins/markdown/search/to-markdown.js";import{AstToSearchNodeTransformer as J}from"../../../plugins/markdown/search/walk-sections.js";import{createRenderTagFn as z}from"../../../plugins/markdown/search/create-render-tag-fn.js";import{canDownloadApiDefinition as B,isResourcePubliclyAccessible as V}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as H}from"../../../../constants/common.js";import{getLlmsTxtMdPathBySlug as I}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{AiSearchIndexer as K}from"../ai-search-indexer.js";import{getLocaleFromRelativePath as Q}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as W}from"./search-facets.js";import{formatDocumentMetadata as X}from"../../search/utils.js";import{llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as Z}from"../store-definition-bundles.js";const k=new Map,we=({parser:s,options:c,info:t,tagOperations:r,relativePath:n,openapiContentItem:e,metadata:i,getSearchFacets:o,includeInLLMsTxt:a,excludeFromSearch:d})=>async(u,m,l,j)=>{if(d)return;const U=await u.getNavText?.()||L(u.fsPath),A=new K(s,c,u.baseSlug||u.slug),p=A.addItem(e);if(!p)return;const O=await l.getConfig(),b=Array.isArray(p.title)?p.title.join(" "):p.title;let $,f,y=k.get(n);if((e.type==="tag"||e.type==="section"&&e.infoDefinition)&&!y){const{all:D,publiclyAccessible:g}=ie(r.tagged,A,O),{all:S,publiclyAccessible:T}=oe(r.untagged,A,O);k.set(n,{taggedSearchDocuments:new Map(D),untaggedSearchDocuments:S,publiclyAccessibleTaggedSearchDocuments:new Map(g),publiclyAccessibleUntaggedSearchDocuments:T})}y=k.get(n);const h="#";switch(e.type){case"operation":const D=A.getOperation(e);$=f=te({title:b,security:s.definition.security,document:p,version:p.version||t.version,headingLevel:h,operation:D});break;case"section":if(e.infoDefinition){y=k.get(n),f=await P({parser:s,info:t,staticData:m,relativePath:n,headingLevel:h,pageName:U,config:O}),f+=`
2
- `;for(const[S,T]of y?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!T.length)continue;const E=s.definition.tags?.find(F=>F.name===S);f+=x({title:E?.["x-displayName"]||S,description:E?.description,operationSearchDocuments:T,headingLevel:`${h}#`})}const g=y?.publiclyAccessibleUntaggedSearchDocuments||[];g.length&&(f+=x({title:"Other",description:void 0,operationSearchDocuments:g,headingLevel:`${h}#`})),$=await P({parser:s,info:t,staticData:m,relativePath:n,headingLevel:h,pageName:U,config:O})}else if(e.ast){const g=new q.Ast.Node("document",{},e.ast),S=Array.from(new J({ast:g,partials:{},renderTag:z(j.markdocOptions.tags),getInnerContent:G,skipConditionals:!0}).transform());f=$=C(S)}break;case"tag":f=x({title:b,description:e.description,operationSearchDocuments:y?.publiclyAccessibleTaggedSearchDocuments.get(e.name)||[],headingLevel:h}),$=x({title:b,description:e.description,operationSearchDocuments:[],headingLevel:h});break;case"rsrc":case"prompt":case"tool":f=ce({title:b,description:e.description,name:e.name,xMcpConfig:s.definition["x-mcp"],headingLevel:h}),$=f;break}return{async getLLMsTxts(){return[{title:e.name,description:e.type==="tag"?e.description:void 0,content:f||"",slug:u.slug,fsPath:u.fsPath,includeInLLMsTxt:a}]},async getSearchDocuments(){if(e.type==="operation"||e.type==="section"&&(e.infoDefinition||e.ast)||e.type==="tag"){const D=Q(u.fsPath),g=W({...p,...i},t,o);return[{title:b,description:Array.isArray(p.text)?p.text.join(" "):p.text,content:$||"",url:p.url??u.slug,fsPath:u.fsPath,locale:D,product:u.product?.name,rbacTeams:p.rbacTeams,facets:g}]}return[]}}};async function P({parser:s,info:c,staticData:t,relativePath:r,pageName:n,headingLevel:e,config:i}){const o=X(c["x-metadata"]);let a=c.title?`${e} ${c.title}
1
+ import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as _,join as q}from"node:path";import C from"@markdoc/markdoc";import{joinSectionContent as J}from"../../../plugins/markdown/search/join-section-content.js";import{toMarkdown as G}from"../../../plugins/markdown/search/to-markdown.js";import{AstToSearchNodeTransformer as z}from"../../../plugins/markdown/search/walk-sections.js";import{createRenderTagFn as B}from"../../../plugins/markdown/search/create-render-tag-fn.js";import{canDownloadApiDefinition as v,isResourcePubliclyAccessible as V}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as H}from"../../../../constants/common.js";import{getLlmsTxtMdPathBySlug as I}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{AiSearchIndexer as K}from"../ai-search-indexer.js";import{getLocaleFromRelativePath as Q}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as W}from"./search-facets.js";import{formatDocumentMetadata as X}from"../../search/utils.js";import{llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as Z}from"../store-definition-bundles.js";const k=new Map,xe=({parser:s,options:c,info:n,tagOperations:r,relativePath:t,openapiContentItem:e,metadata:i,getSearchFacets:u,includeInLLMsTxt:a,excludeFromSearch:f})=>async(o,p,l,j)=>{if(f)return;const P=await o.getNavText?.()||_(o.fsPath),D=new K(s,c,o.baseSlug||o.slug),d=D.addItem(e);if(!d)return;const O=await l.getConfig(),b=Array.isArray(d.title)?d.title.join(" "):d.title;let g,m,y=k.get(t);if((e.type==="tag"||e.type==="section"&&e.infoDefinition)&&!y){const{all:A,publiclyAccessible:$}=ae(r.tagged,D,O),{all:S,publiclyAccessible:T}=ue(r.untagged,D,O);k.set(t,{taggedSearchDocuments:new Map(A),untaggedSearchDocuments:S,publiclyAccessibleTaggedSearchDocuments:new Map($),publiclyAccessibleUntaggedSearchDocuments:T})}y=k.get(t);const h="#";switch(e.type){case"operation":const A=D.getOperation(e);g=m=se({title:b,security:s.definition.security,document:d,version:d.version||n.version,headingLevel:h,operation:A});break;case"section":if(e.infoDefinition){y=k.get(t),m=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:P,config:O}),m+=`
2
+ `;for(const[S,T]of y?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!T.length)continue;const U=s.definition.tags?.find(L=>L.name===S);m+=x({title:U?.["x-displayName"]||S,description:U?.description,operationSearchDocuments:T,headingLevel:`${h}#`})}const $=y?.publiclyAccessibleUntaggedSearchDocuments||[];$.length&&(m+=x({title:"Other",description:void 0,operationSearchDocuments:$,headingLevel:`${h}#`})),g=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:P,config:O})}else if(e.ast){const $=new C.Ast.Node("document",{},e.ast),S=Array.from(new z({ast:$,partials:{},renderTag:B(j.markdocOptions.tags),getInnerContent:G,skipConditionals:!0}).transform());m=g=J(S)}break;case"tag":m=x({title:b,description:e.description,operationSearchDocuments:y?.publiclyAccessibleTaggedSearchDocuments.get(e.name)||[],headingLevel:h}),g=x({title:b,description:e.description,operationSearchDocuments:[],headingLevel:h});break;case"rsrc":case"prompt":case"tool":m=ce({title:b,description:e.description,name:e.name,xMcpConfig:s.definition["x-mcp"],headingLevel:h}),g=m;break}return{async getLLMsTxts(){return[{title:e.name,description:e.type==="tag"?e.description:void 0,content:m||"",slug:o.slug,fsPath:o.fsPath,includeInLLMsTxt:a}]},async getSearchDocuments(){if(e.type==="operation"||e.type==="section"&&(e.infoDefinition||e.ast)||e.type==="tag"){const A=Q(o.fsPath),$=W({...d,...i},n,u);return[{title:b,description:Array.isArray(d.text)?d.text.join(" "):d.text,content:g||"",url:d.url??o.slug,fsPath:o.fsPath,locale:A,product:o.product?.name,rbacTeams:d.rbacTeams,facets:$}]}return[]}}};async function N({parser:s,info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}){const u=X(c["x-metadata"]);let a=c.title?`${e} ${c.title}
3
3
 
4
- `:`${e} ${n}
4
+ `:`${e} ${t}
5
5
 
6
6
  `;return a+=c.description?`${c.description}
7
7
 
@@ -9,84 +9,86 @@ import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as L,join a
9
9
 
10
10
  `:"",a+=c.version?`Version: ${c.version}
11
11
  `:"",a+=c.license?`License: ${c.license.name}
12
- `:"",e=`${e}#`,a+=o.length?`Metadata:
13
- ${o}
12
+ `:"",e=`${e}#`,a+=u.length?`Metadata:
13
+ ${u}
14
14
  `:"",a+=`
15
- `,a+=v({parser:s,headingLevel:e}),a+=ne({parser:s,headingLevel:e}),a+=await ee({info:c,staticData:t,relativePath:r,pageName:n,headingLevel:e,config:i}),a}function x({title:s="",description:c,operationSearchDocuments:t,headingLevel:r}){let n=`${r} ${s}
15
+ `,a+=ee({parser:s,headingLevel:e}),a+=te({parser:s,headingLevel:e}),a+=await ne({info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}),a}function x({title:s="",description:c,operationSearchDocuments:n,headingLevel:r}){let t=`${r} ${s}
16
16
 
17
- `;return c&&(n+=`${c}
17
+ `;return c&&(t+=`${c}
18
18
 
19
- `),t.length&&t.forEach(e=>{const i=Array.isArray(e.title)?e.title.join(" "):e.title;n+=`${r}# ${i}${e.deprecated?" (deprecated)":""}
19
+ `),n.length&&n.forEach(e=>{const i=Array.isArray(e.title)?e.title.join(" "):e.title;t+=`${r}# ${i}${e.deprecated?" (deprecated)":""}
20
20
 
21
- `,n+=` - ${M({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:I(e.url)})}`,n+=`
22
- `}),n}function v({parser:s,headingLevel:c}){const{servers:t}=s.definition;if(t&&t.length){let r=`${c} Servers
21
+ `,t+=` - ${M({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:I(e.url)})}`,t+=`
22
+ `}),t}function ee({parser:s,headingLevel:c}){const{servers:n}=s.definition;if(n&&n.length){let r=`${c} Servers
23
23
 
24
- `;return t.forEach(n=>{r+=n.description?`${n.description}
24
+ `;return n.forEach(t=>{r+=t.description?`${t.description}
25
25
  `:"",r+=`\`\`\`
26
- ${n.url}
26
+ ${t.url}
27
27
  \`\`\`
28
28
 
29
- `,n.variables&&(r+=`Variables:
30
- `,Object.entries(n.variables).forEach(([e,i])=>{r+=`- \`${e}\`${i.description?`: ${i.description}`:""}
29
+ `,t.variables&&(r+=`Variables:
30
+ `,Object.entries(t.variables).forEach(([e,i])=>{r+=`- \`${e}\`${i.description?`: ${i.description}`:""}
31
31
  `,r+=i.default?`Default: ${JSON.stringify(i.default)}
32
- `:"",r+=i.enum?`Enum: ${i.enum.map(o=>JSON.stringify(o)).join(", ")}
32
+ `:"",r+=i.enum?`Enum: ${i.enum.map(u=>JSON.stringify(u)).join(", ")}
33
33
  `:""}),r+=`
34
- `)}),r}return""}async function ee({info:s,staticData:c,relativePath:t,pageName:r,headingLevel:n,config:e}){const i=_(c.props?.outdir||"",Y,Z(t,".yaml")),o=e.access?.rbac,a=e.access?.requiresLogin;if(B(i,o??{},a??!1,{isAuthenticated:!1,teams:[H]})){let d=`${n} Download OpenAPI description
34
+ `)}),r}return""}async function ne({info:s,staticData:c,relativePath:n,pageName:r,headingLevel:t,config:e}){const i=q(c.props?.outdir||"",Y,Z(n,".yaml")),u=e.access?.rbac,a=e.access?.requiresLogin;if(v(i,u??{},a??!1,{isAuthenticated:!1,teams:[H]})){let f=`${t} Download OpenAPI description
35
35
 
36
- `;return d+=M({title:s.title||r||"OpenAPI definition",description:void 0,slug:i}),d}return""}function ne({parser:s,headingLevel:c}){if(!s.definition.components?.securitySchemes)return"";let t=`${c} Security
36
+ `;return f+=M({title:s.title||r||"OpenAPI definition",description:void 0,slug:i}),f}return""}function te({parser:s,headingLevel:c}){if(!s.definition.components?.securitySchemes)return"";let n=`${c} Security
37
37
 
38
- `;const{securitySchemes:r}=s.definition.components;return Object.keys(r).forEach(n=>{const e=r[n];e&&(t+=`${c}# ${n}
38
+ `;const{securitySchemes:r}=s.definition.components;return Object.keys(r).forEach(t=>{const e=r[t];e&&(n+=`${c}# ${t}
39
39
 
40
- `,t+=e.description?`${e.description}
40
+ `,n+=e.description?`${e.description}
41
41
 
42
- `:"",e.type&&(t+=`Type: ${e.type}
43
- `),e.openIdConnectUrl&&(t+=`OpenID Connect URL: ${e.openIdConnectUrl}
44
- `),e.in&&(t+=`In: ${e.in}
45
- `),e.name&&(t+=`Name: ${e.name}
46
- `),e.scheme&&(t+=`Scheme: ${e.scheme}
47
- `),e.bearerFormat&&(t+=`Bearer Format: ${e.bearerFormat}
48
- `),e.flows?.implicit?.authorizationUrl&&(t+=`Authorization URL: ${e.flows.implicit?.authorizationUrl}
49
- `),e.flows?.implicit?.scopes&&(t+=`Scopes:
50
- `,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([i,o])=>{t+=`- \`${i}\`: ${o}
51
- `})),e.flows?.password?.tokenUrl&&(t+=`Token URL: ${e.flows.password?.tokenUrl}
52
- `),e.flows?.password?.scopes&&(t+=`Scopes:
53
- `,Object.entries(e.flows?.password?.scopes||{}).forEach(([i,o])=>{t+=`- \`${i}\`: ${o}
54
- `})),t+=`
55
- `)}),t}function te({title:s,security:c,document:t,version:r,headingLevel:n,operation:e}){const{text:i,httpMethod:o,httpPath:a,deprecated:d}=t,u=re(t.parameters||[],`${n}#`),m=se(`${n}#`,t.parameters,e);let l=s?`${n} ${s}${d?" (deprecated)":""}
42
+ `:"",e.type&&(n+=`Type: ${e.type}
43
+ `),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
44
+ `),e.in&&(n+=`In: ${e.in}
45
+ `),e.name&&(n+=`Name: ${e.name}
46
+ `),e.scheme&&(n+=`Scheme: ${e.scheme}
47
+ `),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
48
+ `),e.flows?.implicit?.authorizationUrl&&(n+=`Authorization URL: ${e.flows.implicit?.authorizationUrl}
49
+ `),e.flows?.implicit?.scopes&&(n+=`Scopes:
50
+ `,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
51
+ `})),e.flows?.password?.tokenUrl&&(n+=`Token URL: ${e.flows.password?.tokenUrl}
52
+ `),e.flows?.password?.scopes&&(n+=`Scopes:
53
+ `,Object.entries(e.flows?.password?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
54
+ `})),n+=`
55
+ `)}),n}function se({title:s,security:c,document:n,version:r,headingLevel:t,operation:e}){const{text:i,httpMethod:u,httpPath:a,deprecated:f}=n,o=oe(n.parameters||[],`${t}#`),p=re(`${t}#`,n.parameters,e);let l=s?`${t} ${s}${f?" (deprecated)":""}
56
56
 
57
57
  `:"";return l+=i?`${i}
58
58
 
59
- `:"",l+=`Endpoint: ${o?.toUpperCase()} ${a}
59
+ `:"",l+=`Endpoint: ${u?.toUpperCase()} ${a}
60
60
  `,l+=r?`Version: ${r}
61
- `:"",l+=t.security?.length?`Security: ${t.security.join(", ")}
61
+ `:"",l+=n.security?.length?`Security: ${n.security.join(", ")}
62
62
  `:c?.length?`Security: ${c.map(j=>j.id).join(", ")}
63
63
  `:"",l+=`
64
- `,l+=u?`${u}
64
+ `,l+=o?`${o}
65
65
  `:"",l+=`
66
- `,l+=`${m.join(`
67
- `)}`,l}function ce({title:s,name:c,xMcpConfig:t,headingLevel:r}){const n=t?.tools.find(i=>i.name===c);if(!n)return"";let e=`${r} ${s}
66
+ `,l+=`${p.join(`
67
+ `)}`,l}function ce({title:s,name:c,xMcpConfig:n,headingLevel:r}){const t=n?.tools.find(i=>i.name===c);if(!t)return"";let e=`${r} ${s}
68
68
 
69
- `;return e+=n.description?`${n.description}
69
+ `;return e+=t.description?`${t.description}
70
70
 
71
71
  `:"",e+=`${r}# Input schema:
72
72
 
73
73
  `,e+=`\`\`\`json
74
- ${JSON.stringify(n.inputSchema,null,2)}
74
+ ${JSON.stringify(t.inputSchema,null,2)}
75
75
  \`\`\`
76
76
 
77
- `,n.outputSchema&&(e+=`${r}# Output schema:
77
+ `,t.outputSchema&&(e+=`${r}# Output schema:
78
78
 
79
79
  `,e+=`\`\`\`json
80
- ${JSON.stringify(n.outputSchema,null,2)}
80
+ ${JSON.stringify(t.outputSchema,null,2)}
81
81
  \`\`\`
82
82
 
83
- `),e}function se(s,c,t){return!c&&!t||!t?.responses?[]:t?.responses.filter(n=>!n.content?.mediaTypes[0]?.schema).map(n=>`${s} ${R(`response ${n.code} fields`)}
84
- `)}function re(s,c){const t={};for(const n of s){const e=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;t[e]=[...t[e]||[],n]}return Object.entries(t).map(([n,e])=>{const i=e.map(o=>{const a=" ",d=[...o.path||[],o.name],u=Array.isArray(o.description)?o.description.join(" "):o.description;let m=` - \`${d.join(".")}\` (${o.type}${o.required?", required":""})
85
- `;return m+=u?`${a}${u.trim()}
86
- `:"",o.enum?m+=`${a}Enum: ${o.enum.map(l=>JSON.stringify(l)).join(", ")}
87
- `:o.example&&(m+=`${a}Example: ${o.example}
88
- `),m});return`${c} ${R(n)}:
83
+ `),e}function re(s,c,n){return!c&&!n||!n?.responses?[]:n?.responses.filter(t=>!t.content?.mediaTypes[0]?.schema).map(t=>`${s} ${R(`response ${t.code} fields`)}
84
+ `)}function ie(s,c,n,r){const t=JSON.stringify(s),e=r.get(t);return e?`${n}Enum: same as ${e} (${s.length} values)
85
+ `:(r.set(t,c),`${n}Enum: ${s.map(i=>JSON.stringify(i)).join(", ")}
86
+ `)}function E(s,c,n,r){const t=`${c} `,e=s.oneOf,u=[...s.path||[],s.name].join("."),a=Array.isArray(s.description)?s.description.join(" "):s.description,f=!!e&&e.variants.length>1;let o=`${c}- \`${u}\` (${s.type}${s.required?", required":""})`;if(f&&(o+=e.discriminator?` \u2014 one of (discriminator: ${e.discriminator}):`:" \u2014 one of:"),o+=`
87
+ `,o+=a?`${t}${a.trim()}
88
+ `:"",s.enum){const p=r?`\`${u}\` in "${r}"`:`\`${u}\``;o+=ie(s.enum,p,t,n)}else s.example&&(o+=`${t}Example: ${s.example}
89
+ `);if(f)for(const p of e.variants){o+=`${c} - ${p.title}:
90
+ `;for(const l of p.parameters)o+=E(l,`${c} `,n,p.title)}else if(e)for(const p of e.variants[0].parameters)o+=E(p,`${c} `,n);return o}function oe(s,c){const n={};for(const e of s){const i=`${e.place}${e.mediaType?` (${e.mediaType})`:""}`;n[i]=[...n[i]||[],e]}const r=new Map;return Object.entries(n).map(([e,i])=>{const u=i.map(a=>E(a," ",r));return`${c} ${R(e)}:
89
91
 
90
- ${i.join(`
92
+ ${u.join(`
91
93
  `)}`}).join(`
92
- `)}function ie(s,c,t){const r=[],n=[];return s.forEach((e,i)=>{const o=[],a=[];e.forEach(d=>{const u=c.addItem(d);u&&(o.push(u),N({[w]:d[w],slug:u.url},t)&&a.push(u))}),r.push([i,o]),n.push([i,a])}),{all:r,publiclyAccessible:n}}function oe(s,c,t){const r=[],n=[];return s.forEach(e=>{const i=c.addItem(e);i&&(r.push(i),N({[w]:e[w],slug:i.url},t)&&n.push(i))}),{all:r,publiclyAccessible:n}}function R(s){return s.charAt(0).toUpperCase()+s.slice(1)}function N(s,c){return c.access?.requiresLogin?!0:V(s,c)}export{we as getAiDocumentsStore};
94
+ `)}function ae(s,c,n){const r=[],t=[];return s.forEach((e,i)=>{const u=[],a=[];e.forEach(f=>{const o=c.addItem(f);o&&(u.push(o),F({[w]:f[w],slug:o.url},n)&&a.push(o))}),r.push([i,u]),t.push([i,a])}),{all:r,publiclyAccessible:t}}function ue(s,c,n){const r=[],t=[];return s.forEach(e=>{const i=c.addItem(e);i&&(r.push(i),F({[w]:e[w],slug:i.url},n)&&t.push(i))}),{all:r,publiclyAccessible:t}}function R(s){return s.charAt(0).toUpperCase()+s.slice(1)}function F(s,c){return c.access?.requiresLogin?!0:V(s,c)}export{xe as getAiDocumentsStore};
@@ -1,6 +1,17 @@
1
1
  import type { OperationMenuItem } from '@redocly/openapi-docs/lib/models';
2
+ import type { OperationParameter } from '@redocly/theme/core/types';
2
3
  export type TagOperations = {
3
4
  untagged: OperationMenuItem[];
4
5
  tagged: Map<string, OperationMenuItem[]>;
5
6
  };
7
+ export type SchemaVariant = {
8
+ title: string;
9
+ parameters: OperationParameter[];
10
+ };
11
+ export type OperationParameterWithVariants = OperationParameter & {
12
+ oneOf?: {
13
+ discriminator?: string;
14
+ variants: SchemaVariant[];
15
+ };
16
+ };
6
17
  //# sourceMappingURL=types.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { IMenuItem } from '@redocly/openapi-docs';
1
+ import type { IMenuItem, SchemaModel } from '@redocly/openapi-docs';
2
2
  import type { ItemBadge, NavItem, ResolvedNavItem } from '@redocly/config';
3
3
  export type IMenuItemExtended = {
4
4
  httpVerb?: string;
@@ -17,4 +17,9 @@ export declare function shouldAddRoute({ item }: {
17
17
  export declare const removeMarkdownLinks: (text: string | Record<string, any>) => any;
18
18
  export declare function normalizeFeedbackOptions(feedbackOptions: Record<string, any> | null | undefined): Record<string, any> | undefined;
19
19
  export declare function stripFormatting(text: string | Record<string, any> | null): string;
20
+ /**
21
+ * Returns the oneOf schema when `schema` (or, for an array, its items) is a
22
+ * oneOf/anyOf/discriminator — the single `oneOf` property the model uses for all of them.
23
+ */
24
+ export declare function getOneOfSchema(schema: SchemaModel | undefined): SchemaModel | undefined;
20
25
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{combineUrls as p}from"@redocly/theme/core/utils";import{FEEDBACK_TYPES as c}from"../../../constants/common.js";import{normalizeRouteSlug as h}from"../../../utils/path/normalize-route-slug.js";function u(t){const{contentItems:o,sidebarItems:n,routeSlug:r,navItem:s}=t;let b=!0;for(const e of o){let a;switch(e.type){case"group":n.push({type:"separator",label:e.name,[i]:e[i]}),u({...t,contentItems:e.items,sidebarItems:n});break;case"tag":a=p(r,e.href);const m={type:"group",label:e.name,items:[],link:a,routeSlug:a,[i]:e[i]};n.push(m),u({routeSlug:r,contentItems:e.items,sidebarItems:m.items||[],navItem:s});break;case"operation":case"schema":case"rsrc":case"prompt":case"tool":e.isWebhook&&b&&(n.push({type:"separator",label:"Webhooks",variant:"secondary"}),b=!1),a=p(r,e.href),n.push({type:"link",label:e.name,httpVerb:e.type==="operation"?e.httpVerb:e.type,routeSlug:h(a),badges:e.badges,link:a,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation,[i]:e[i]});break;case"section":if(e.depth===-1)continue;a=p(r,e.href);const l=e.href==="/",g={type:e.items.length?"group":"link",label:l&&s?.label?s.label:e.name,labelTranslationKey:s?.labelTranslationKey,routeSlug:a.split("#")[0]===r?r:h(a),link:a,items:[],...l&&s?.icon&&{icon:typeof s.icon=="object"?s.icon.srcSet:s.icon},...l&&s?.badges&&{badges:s.badges}};n.push(g),e.items.length&&u({routeSlug:r,contentItems:e.items,sidebarItems:g.items});break}}}function S({item:t}){return t.id===""?!0:t.type!=="group"||t.description!==""}const I=t=>(typeof t=="string"?t:t?.raw)?.replace(/\[(.*?)\][\[\(].*?[\]\)]/g,"$1")||"";function A(t){if(!t)return;let o="";const{type:n,settings:r}=t;switch(n){case c.RATING:o="Rate this section";break;case c.SENTIMENT:o="Was this section helpful?";break;case c.MOOD:o="Was this section helpful?";break;case c.COMMENT:o="Share your feedback about this section";break;case c.SCALE:o="How would you rate this section?";break}return{...t,settings:{...r,label:r?.label||o}}}function E(t){return(typeof t=="string"?t:t?.raw||"").replace(/<[^>]*>/g,"").replace(/```([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").trim()}export{u as convertOpenAPIDocs2Sidebar,A as normalizeFeedbackOptions,I as removeMarkdownLinks,S as shouldAddRoute,E as stripFormatting};
1
+ import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{combineUrls as p}from"@redocly/theme/core/utils";import{FEEDBACK_TYPES as c}from"../../../constants/common.js";import{normalizeRouteSlug as g}from"../../../utils/path/normalize-route-slug.js";function u(t){const{contentItems:r,sidebarItems:a,routeSlug:o,navItem:s}=t;let b=!0;for(const e of r){let n;switch(e.type){case"group":a.push({type:"separator",label:e.name,[i]:e[i]}),u({...t,contentItems:e.items,sidebarItems:a});break;case"tag":n=p(o,e.href);const m={type:"group",label:e.name,items:[],link:n,routeSlug:n,[i]:e[i]};a.push(m),u({routeSlug:o,contentItems:e.items,sidebarItems:m.items||[],navItem:s});break;case"operation":case"schema":case"rsrc":case"prompt":case"tool":e.isWebhook&&b&&(a.push({type:"separator",label:"Webhooks",variant:"secondary"}),b=!1),n=p(o,e.href),a.push({type:"link",label:e.name,httpVerb:e.type==="operation"?e.httpVerb:e.type,routeSlug:g(n),badges:e.badges,link:n,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation,[i]:e[i]});break;case"section":if(e.depth===-1)continue;n=p(o,e.href);const l=e.href==="/",f={type:e.items.length?"group":"link",label:l&&s?.label?s.label:e.name,labelTranslationKey:s?.labelTranslationKey,routeSlug:n.split("#")[0]===o?o:g(n),link:n,items:[],...l&&s?.icon&&{icon:typeof s.icon=="object"?s.icon.srcSet:s.icon},...l&&s?.badges&&{badges:s.badges}};a.push(f),e.items.length&&u({routeSlug:o,contentItems:e.items,sidebarItems:f.items});break}}}function S({item:t}){return t.id===""?!0:t.type!=="group"||t.description!==""}const I=t=>(typeof t=="string"?t:t?.raw)?.replace(/\[(.*?)\][\[\(].*?[\]\)]/g,"$1")||"";function O(t){if(!t)return;let r="";const{type:a,settings:o}=t;switch(a){case c.RATING:r="Rate this section";break;case c.SENTIMENT:r="Was this section helpful?";break;case c.MOOD:r="Was this section helpful?";break;case c.COMMENT:r="Share your feedback about this section";break;case c.SCALE:r="How would you rate this section?";break}return{...t,settings:{...o,label:o?.label||r}}}function A(t){return(typeof t=="string"?t:t?.raw||"").replace(/<[^>]*>/g,"").replace(/```([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").trim()}function E(t){if(t?.oneOf)return t;if(t?.items?.oneOf)return t.items}export{u as convertOpenAPIDocs2Sidebar,E as getOneOfSchema,O as normalizeFeedbackOptions,I as removeMarkdownLinks,S as shouldAddRoute,A as stripFormatting};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/realm",
3
- "version": "0.134.0-next.6",
3
+ "version": "0.134.0-next.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,7 +54,7 @@
54
54
  "flexsearch": "0.7.43",
55
55
  "graphql": "16.12.0",
56
56
  "gray-matter": "4.0.3",
57
- "hono": "4.12.18",
57
+ "hono": "4.12.23",
58
58
  "htmlparser2": "8.0.2",
59
59
  "i18next": "22.4.15",
60
60
  "is-glob": "4.0.3",
@@ -91,14 +91,14 @@
91
91
  "xpath": "0.0.34",
92
92
  "yaml-ast-parser": "0.0.43",
93
93
  "zod": "^3.25.76",
94
- "@redocly/asyncapi-docs": "1.11.0-next.5",
94
+ "@redocly/asyncapi-docs": "1.11.0-next.6",
95
95
  "@redocly/config": "0.49.0",
96
- "@redocly/graphql-docs": "1.11.0-next.5",
97
- "@redocly/openapi-docs": "3.22.0-next.5",
96
+ "@redocly/graphql-docs": "1.11.0-next.6",
97
+ "@redocly/openapi-docs": "3.22.0-next.6",
98
98
  "@redocly/portal-legacy-ui": "0.17.0-next.1",
99
- "@redocly/portal-plugin-mock-server": "0.19.0-next.5",
99
+ "@redocly/portal-plugin-mock-server": "0.19.0-next.6",
100
100
  "@redocly/realm-asyncapi-sdk": "0.12.0-next.3",
101
- "@redocly/theme": "0.66.0-next.4"
101
+ "@redocly/theme": "0.66.0-next.5"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": "^19.2.4",