@mintlify/common 1.0.1362 → 1.0.1363

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,16 @@
1
- import { OpenAPI } from 'openapi-types';
1
+ import { OpenAPI, OpenAPIV3 } from 'openapi-types';
2
+ type TagWithExtensions = OpenAPIV3.TagObject & {
3
+ 'x-group'?: string;
4
+ 'x-displayName'?: string;
5
+ };
2
6
  /**
3
- * Resolves the display name for a tag. Prioritizes x-group extension, falls back to tag name.
7
+ * Resolves a tag label from its extensions: the x-group extension first, then the Redocly
8
+ * x-displayName extension. Returns undefined when neither is set.
9
+ */
10
+ export declare const getTagLabelFromExtensions: (tag: Pick<TagWithExtensions, 'x-group' | 'x-displayName'> | undefined) => string | undefined;
11
+ /**
12
+ * Resolves the display name for a tag. Prioritizes the x-group extension, then the Redocly
13
+ * x-displayName extension, and falls back to the tag name.
4
14
  */
5
15
  export declare const getTagDisplayName: (tagName: string | undefined, schema: Pick<OpenAPI.Document, 'tags'>) => string | undefined;
16
+ export {};
@@ -1,5 +1,11 @@
1
1
  /**
2
- * Resolves the display name for a tag. Prioritizes x-group extension, falls back to tag name.
2
+ * Resolves a tag label from its extensions: the x-group extension first, then the Redocly
3
+ * x-displayName extension. Returns undefined when neither is set.
4
+ */
5
+ export const getTagLabelFromExtensions = (tag) => { var _a; return (_a = tag === null || tag === void 0 ? void 0 : tag['x-group']) !== null && _a !== void 0 ? _a : tag === null || tag === void 0 ? void 0 : tag['x-displayName']; };
6
+ /**
7
+ * Resolves the display name for a tag. Prioritizes the x-group extension, then the Redocly
8
+ * x-displayName extension, and falls back to the tag name.
3
9
  */
4
10
  export const getTagDisplayName = (tagName, schema) => {
5
11
  var _a;
@@ -9,5 +15,5 @@ export const getTagDisplayName = (tagName, schema) => {
9
15
  if (!tags)
10
16
  return tagName;
11
17
  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;
18
+ return (_a = getTagLabelFromExtensions(tagDef)) !== null && _a !== void 0 ? _a : tagName;
13
19
  };
@@ -2,6 +2,7 @@ import type { DocumentV3, OpenAPIV3_2 } from '@mintlify/validation';
2
2
  import type { OpenAPI } from 'openapi-types';
3
3
  export type OpenApiTag = OpenAPIV3_2.TagObject & {
4
4
  'x-group'?: string;
5
+ 'x-displayName'?: string;
5
6
  };
6
7
  export type OpenApiTagGroup = {
7
8
  name: string;
@@ -1,4 +1,4 @@
1
- import { getTagDisplayName } from './getTagDisplayName.js';
1
+ import { getTagDisplayName, getTagLabelFromExtensions } from './getTagDisplayName.js';
2
2
  import { isOpenApi32Version } from './validate.js';
3
3
  export const isOpenApi32 = (schema) => 'openapi' in schema && isOpenApi32Version(schema.openapi);
4
4
  export function validateOpenApiTagTree(tags = []) {
@@ -53,7 +53,7 @@ export function createOpenApiTagResolver(schema) {
53
53
  if ((tag === null || tag === void 0 ? void 0 : tag.kind) === undefined || tag.kind === 'nav' || current === name) {
54
54
  path.push({
55
55
  name: current,
56
- label: (_a = tag === null || tag === void 0 ? void 0 : tag['x-group']) !== null && _a !== void 0 ? _a : ((tag === null || tag === void 0 ? void 0 : tag.summary) || current),
56
+ label: (_a = getTagLabelFromExtensions(tag)) !== null && _a !== void 0 ? _a : ((tag === null || tag === void 0 ? void 0 : tag.summary) || current),
57
57
  key: current,
58
58
  });
59
59
  }