@mintlify/common 1.0.847 → 1.0.849
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.
|
@@ -5,6 +5,7 @@ import { slugToTitle } from '../slug/slugToTitle.js';
|
|
|
5
5
|
import { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
6
6
|
import { prepareStringToBeValidFilename, generateUniqueFilenameWithoutExtension, } from './filenameUtils.js';
|
|
7
7
|
import { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.js';
|
|
8
|
+
import { getTagDisplayName } from './getTagDisplayName.js';
|
|
8
9
|
/**
|
|
9
10
|
* Build MDX content string matching what createOpenApiFrontmatter produces in prebuild.
|
|
10
11
|
* Includes title, description, openapi tag, version, deprecated, and all x-mint metadata
|
|
@@ -103,9 +104,10 @@ export function generateOpenApiPages(opts) {
|
|
|
103
104
|
continue;
|
|
104
105
|
const xMint = operation['x-mint'];
|
|
105
106
|
const xMintGroups = getXMintGroups(pathItem, operation);
|
|
106
|
-
const
|
|
107
|
+
const tagName = (_b = operation.tags) === null || _b === void 0 ? void 0 : _b[0];
|
|
108
|
+
const groupName = getTagDisplayName(tagName, spec);
|
|
107
109
|
let title = (_c = prepareStringToBeValidFilename(operation.summary)) !== null && _c !== void 0 ? _c : `${method}-${prepareStringToBeValidFilename(apiPath)}`;
|
|
108
|
-
let folder = (_d = prepareStringToBeValidFilename(
|
|
110
|
+
let folder = (_d = prepareStringToBeValidFilename(tagName)) !== null && _d !== void 0 ? _d : '';
|
|
109
111
|
let base = posixJoin(outDir, folder, title);
|
|
110
112
|
if (xMint === null || xMint === void 0 ? void 0 : xMint.href) {
|
|
111
113
|
const href = xMint.href.startsWith('/') ? xMint.href.slice(1) : xMint.href;
|
|
@@ -167,9 +169,10 @@ export function generateOpenApiPages(opts) {
|
|
|
167
169
|
if (operation['x-excluded'])
|
|
168
170
|
continue;
|
|
169
171
|
const xMint = operation['x-mint'];
|
|
170
|
-
const
|
|
172
|
+
const tagName = (_j = operation.tags) === null || _j === void 0 ? void 0 : _j[0];
|
|
173
|
+
const groupName = getTagDisplayName(tagName, spec);
|
|
171
174
|
let title = (_k = prepareStringToBeValidFilename(operation.summary)) !== null && _k !== void 0 ? _k : `${prepareStringToBeValidFilename(webhook)}`;
|
|
172
|
-
let folder = (_l = prepareStringToBeValidFilename(
|
|
175
|
+
let folder = (_l = prepareStringToBeValidFilename(tagName)) !== null && _l !== void 0 ? _l : '';
|
|
173
176
|
let base = posixJoin(outDir, folder, title);
|
|
174
177
|
if (xMint === null || xMint === void 0 ? void 0 : xMint.href) {
|
|
175
178
|
const href = xMint.href.startsWith('/') ? xMint.href.slice(1) : xMint.href;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the display name for a tag. Prioritizes x-group extension, falls back to tag name.
|
|
3
|
+
*/
|
|
4
|
+
export const getTagDisplayName = (tagName, schema) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (!tagName)
|
|
7
|
+
return undefined;
|
|
8
|
+
const tags = schema.tags;
|
|
9
|
+
if (!tags)
|
|
10
|
+
return tagName;
|
|
11
|
+
const tagDef = tags.find((t) => t.name === tagName);
|
|
12
|
+
return (_a = tagDef === null || tagDef === void 0 ? void 0 : tagDef['x-group']) !== null && _a !== void 0 ? _a : tagName;
|
|
13
|
+
};
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { openApiMetaTagToEndpointRef } from './endpointRef.js';
|
|
|
12
12
|
export { prepareStringToBeValidFilename, generateUniqueFilenameWithoutExtension, } from './filenameUtils.js';
|
|
13
13
|
export { findNavGroup, DEFAULT_API_GROUP_NAME, DEFAULT_WEBSOCKETS_GROUP_NAME, } from './findNavGroup.js';
|
|
14
14
|
export { generateOpenApiPages, buildGeneratedMdxContent, type GeneratedApiPage, type GenerateOpenApiPagesOptions, } from './generateOpenApiPages.js';
|
|
15
|
+
export { getTagDisplayName } from './getTagDisplayName.js';
|
package/dist/openapi/index.js
CHANGED
|
@@ -12,3 +12,4 @@ export { openApiMetaTagToEndpointRef } from './endpointRef.js';
|
|
|
12
12
|
export { prepareStringToBeValidFilename, generateUniqueFilenameWithoutExtension, } from './filenameUtils.js';
|
|
13
13
|
export { findNavGroup, DEFAULT_API_GROUP_NAME, DEFAULT_WEBSOCKETS_GROUP_NAME, } from './findNavGroup.js';
|
|
14
14
|
export { generateOpenApiPages, buildGeneratedMdxContent, } from './generateOpenApiPages.js';
|
|
15
|
+
export { getTagDisplayName } from './getTagDisplayName.js';
|