@redocly/openapi-docs 3.15.0-next.3 → 3.15.0-next.4
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 +240 -116
- package/lib/models/group.js +1 -1
- package/lib/models/types.d.ts +1 -0
- package/lib/services/menu/builder.js +1 -1
- package/lib/services/menu/tags.js +2 -2
- package/lib/services/types.d.ts +1 -0
- package/lib/types/open-api.d.ts +2 -0
- package/package.json +3 -3
package/lib/models/group.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{joinWithSeparator as h}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as w}from"../utils/saveTextBeforeHeading.js";function r(i,e,s){let n;s?.id&&(i==="schema"||i==="mcp")?n=h(s.id,o(e.name)):n=e.id||o(e.name);const d=e["x-displayName"]||e.name,c=e.level||1,t=e.isSchema,f=e.ast||void 0,l=w(S(e,"description")||""),a=e.items||[],x=e.externalDocs;return{id:n.toLowerCase(),type:i,parent:s,name:d,level:c,depth:0,isSchema:t,description:l,items:a,ast:f,externalDocs:x,href:v({id:n}),[m]:e[m]||s?.[m],keywords:i==="tag"?e["x-keywords"]:void 0}}export{r as getTagOrGroup};
|
package/lib/models/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function
|
|
1
|
+
import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function E(o,s){const e=x(o,s),i=h(e||[],"items");return{contentItems:e,flatItems:i}}export{E as buildContentItems,x as buildMenuStructure};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as
|
|
2
|
-
{% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer
|
|
1
|
+
import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as k,safeSlugify as w}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as x}from"./markdown.js";import{joinWithSeparator as $}from"../history/helpers.js";const y=["tools"];function N(s,c,o,e,a){let t;if(e===void 0?t=Object.keys(c):t=e.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(n=>c[n]?(c[n].used=!0,c[n]):(console.warn(`Non-existing tag "${n}" is added to the group "${e?.name}"`),null)),i=[];for(const n of f){if(!n)continue;const r=d("tag",n,o);if(r.depth=g+1,n.name===""){const P=[...x(h(n,"description")||"",r,r.depth+1),...T(void 0,n,r.depth+1)];i.push(...P);continue}const p=b({definition:s.definition,tag:n,parent:r,schemaDefinitionsTagName:a.schemaDefinitionsTagName}),m=v(s.definition,n,r);r.items=[...p,...m,...x(h(n,"description")||"",r,r.depth+1),...T(r,n,r.depth+1)],i.push(r)}return i.filter(({name:n,items:r})=>n!==l||r.length>0)}function R(s,c,o,e,a){const t=[];for(const f of o){const i=d("group",f,c);i.depth=g,i.items=N(s,e,i,f,a),t.push(i)}return t}function b({definition:s,tag:c,parent:o,schemaDefinitionsTagName:e}){const a=e?[e]:[];return Object.entries(s.components?.schemas||{}).map(([t,f])=>{if(!(f["x-tags"]||a).includes(c.name))return null;const n=d("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return n.depth=o.depth+1,n}).filter(Boolean)}function v(s,c,o){const e=[];for(const a of y)if(s["x-mcp"]?.[a]){const t=O(a),f=[t];for(const i of s["x-mcp"]?.[a]||[])if((i.tags?.length?i.tags:f).includes(c.name)){const r=$(o.id,w(i.name)),p=d("mcp",{name:i.name,"x-displayName":i.title||i.name,description:`${i.description||""}
|
|
2
|
+
{% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer:k.compile(["paths",a,i]),httpVerb:i,pathParameters:t.parameters||[],pathServers:t.servers,isWebhook:!!e,keywords:n["x-keywords"]})}}}}function O(s){return s.charAt(0).toUpperCase()+s.slice(1)}export{O as capitalize,R as getTagGroupsItems,N as getTagsItems,U as getTagsWithOperations};
|
package/lib/services/types.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export type ExtendedOpenAPIOperation = {
|
|
|
51
51
|
pathServers: Array<OpenAPIServer> | undefined;
|
|
52
52
|
isWebhook: boolean;
|
|
53
53
|
defaultSampleName?: string | false;
|
|
54
|
+
keywords?: unknown;
|
|
54
55
|
} & OpenAPIOperation;
|
|
55
56
|
export type TagsInfoMap = Record<string, TagInfo>;
|
|
56
57
|
export interface TagGroup {
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface OpenAPIDefinition {
|
|
|
18
18
|
}>;
|
|
19
19
|
'x-feedback'?: any;
|
|
20
20
|
'x-schema-catalog-link'?: string;
|
|
21
|
+
'x-keywords'?: unknown;
|
|
21
22
|
}
|
|
22
23
|
export interface OpenAPIInfo extends ParsedDescriptionWithSummary {
|
|
23
24
|
title: string;
|
|
@@ -361,6 +362,7 @@ export interface OpenAPITag extends ParsedDescription {
|
|
|
361
362
|
externalDocs?: OpenAPIExternalDocumentation;
|
|
362
363
|
'x-displayName'?: string;
|
|
363
364
|
'x-rbac'?: Record<string, unknown>;
|
|
365
|
+
'x-keywords'?: unknown;
|
|
364
366
|
}
|
|
365
367
|
export interface OpenAPIExternalDocumentation extends ParsedDescription {
|
|
366
368
|
description?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.15.0-next.
|
|
3
|
+
"version": "3.15.0-next.4",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.36.0",
|
|
40
|
-
"@redocly/replay": "0.18.0-next.
|
|
40
|
+
"@redocly/replay": "0.18.0-next.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
77
|
"vite": "7.1.9",
|
|
78
|
-
"@redocly/theme": "0.59.0-next.
|
|
78
|
+
"@redocly/theme": "0.59.0-next.3"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|