@mintlify/validation 0.1.848 → 0.1.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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/mint-config/collectOpenApiOverlays.d.ts +13 -0
- package/dist/mint-config/collectOpenApiOverlays.js +73 -0
- package/dist/mint-config/schemas/v2/index.d.ts +1280 -330
- package/dist/mint-config/schemas/v2/properties/api.d.ts +30 -5
- package/dist/mint-config/schemas/v2/properties/navigation/divisionNav.d.ts +30 -5
- package/dist/mint-config/schemas/v2/properties/navigation/groups.d.ts +14 -4
- package/dist/mint-config/schemas/v2/properties/navigation/index.d.ts +56 -16
- package/dist/mint-config/schemas/v2/properties/navigation/pages.d.ts +14 -4
- package/dist/mint-config/schemas/v2/properties/reusable/openapi.d.ts +26 -1
- package/dist/mint-config/schemas/v2/properties/reusable/openapi.js +23 -2
- package/dist/mint-config/schemas/v2/themes/almond.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/aspen.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/linden.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/luma.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/maple.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/mint.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/palm.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/reusable/index.d.ts +86 -21
- package/dist/mint-config/schemas/v2/themes/sequoia.d.ts +128 -33
- package/dist/mint-config/schemas/v2/themes/willow.d.ts +128 -33
- package/dist/mint-config/validateConfig.d.ts +378 -108
- package/dist/openapi/overlay.d.ts +555 -0
- package/dist/openapi/overlay.js +118 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export { generateFirstIncrementalSchema, generateNextIncrementalSchema, } from '
|
|
|
9
9
|
export * from './mint-config/validateConfig.js';
|
|
10
10
|
export { formatIssue } from './mint-config/formatIssue.js';
|
|
11
11
|
export { upgradeToDocsConfig } from './mint-config/upgrades/upgradeToDocsConfig.js';
|
|
12
|
+
export { collectOpenApiOverlayConfig, normalizeOpenApiSourceKey, type ExplicitOverlayConfig, } from './mint-config/collectOpenApiOverlays.js';
|
|
13
|
+
export { overlayDocumentSchema, overlayActionSchema, overlayInfoSchema, isOverlayDocument, parseOverlayDocument, safeParseOverlayDocument, type OverlayDocument, type OverlayAction, type OverlayInfo, } from './openapi/overlay.js';
|
|
12
14
|
export { convertMintDecoratedNavToDocsDecoratedNav } from './mint-config/upgrades/convertMintDecoratedNavToDocsDecoratedNav.js';
|
|
13
15
|
export declare const mintConfigJsonSchema: import("zod-to-json-schema/src/parseDef.js").JsonSchema7Type & {
|
|
14
16
|
$schema?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,8 @@ export { generateFirstIncrementalSchema, generateNextIncrementalSchema, } from '
|
|
|
29
29
|
export * from './mint-config/validateConfig.js';
|
|
30
30
|
export { formatIssue } from './mint-config/formatIssue.js';
|
|
31
31
|
export { upgradeToDocsConfig } from './mint-config/upgrades/upgradeToDocsConfig.js';
|
|
32
|
+
export { collectOpenApiOverlayConfig, normalizeOpenApiSourceKey, } from './mint-config/collectOpenApiOverlays.js';
|
|
33
|
+
export { overlayDocumentSchema, overlayActionSchema, overlayInfoSchema, isOverlayDocument, parseOverlayDocument, safeParseOverlayDocument, } from './openapi/overlay.js';
|
|
32
34
|
export { convertMintDecoratedNavToDocsDecoratedNav } from './mint-config/upgrades/convertMintDecoratedNavToDocsDecoratedNav.js';
|
|
33
35
|
export const mintConfigJsonSchema = zodToJsonSchema(mintConfigSchema, 'Schema');
|
|
34
36
|
export const docsConfigJsonSchema = zodToJsonSchema(docsConfigSchema, {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized OpenAPI source -> ordered explicit overlay refs from docs.json.
|
|
3
|
+
* An empty array means "no overlays, including auto-discovered ones".
|
|
4
|
+
*/
|
|
5
|
+
export type ExplicitOverlayConfig = Map<string, string[]>;
|
|
6
|
+
/** Canonical source key: URLs unchanged, relative paths normalized without leading slash. */
|
|
7
|
+
export declare function normalizeOpenApiSourceKey(source: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Walks every `openapi` entry in a (possibly unvalidated) docs or mint config and
|
|
10
|
+
* returns the explicit overlay lists per normalized source. Throws when the same
|
|
11
|
+
* source is configured with two different lists.
|
|
12
|
+
*/
|
|
13
|
+
export declare function collectOpenApiOverlayConfig(docsConfig: unknown): ExplicitOverlayConfig;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { isAbsoluteUrl } from './isAbsoluteUrl.js';
|
|
2
|
+
import { extractOpenApiEntries, } from './schemas/v2/properties/reusable/openapi.js';
|
|
3
|
+
import { normalizeRelativePath } from './transforms/normalizeRelativePath.js';
|
|
4
|
+
/** Canonical source key: URLs unchanged, relative paths normalized without leading slash. */
|
|
5
|
+
export function normalizeOpenApiSourceKey(source) {
|
|
6
|
+
if (isAbsoluteUrl(source))
|
|
7
|
+
return source;
|
|
8
|
+
return normalizeRelativePath(source);
|
|
9
|
+
}
|
|
10
|
+
function isOpenApiConfigLike(value) {
|
|
11
|
+
if (typeof value === 'string')
|
|
12
|
+
return true;
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
return value.every((entry) => typeof entry === 'string' ||
|
|
15
|
+
(typeof entry === 'object' &&
|
|
16
|
+
entry !== null &&
|
|
17
|
+
'source' in entry &&
|
|
18
|
+
typeof entry.source === 'string'));
|
|
19
|
+
}
|
|
20
|
+
return (typeof value === 'object' &&
|
|
21
|
+
value !== null &&
|
|
22
|
+
'source' in value &&
|
|
23
|
+
typeof value.source === 'string');
|
|
24
|
+
}
|
|
25
|
+
function collectEntriesDeep(value, acc, seen) {
|
|
26
|
+
if (value === null || typeof value !== 'object')
|
|
27
|
+
return;
|
|
28
|
+
if (seen.has(value))
|
|
29
|
+
return;
|
|
30
|
+
seen.add(value);
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
for (const item of value) {
|
|
33
|
+
collectEntriesDeep(item, acc, seen);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const record = Object.fromEntries(Object.entries(value));
|
|
38
|
+
if ('openapi' in record && isOpenApiConfigLike(record.openapi)) {
|
|
39
|
+
acc.push(...extractOpenApiEntries(record.openapi));
|
|
40
|
+
}
|
|
41
|
+
for (const [key, child] of Object.entries(record)) {
|
|
42
|
+
if (key === 'openapi')
|
|
43
|
+
continue;
|
|
44
|
+
collectEntriesDeep(child, acc, seen);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Walks every `openapi` entry in a (possibly unvalidated) docs or mint config and
|
|
49
|
+
* returns the explicit overlay lists per normalized source. Throws when the same
|
|
50
|
+
* source is configured with two different lists.
|
|
51
|
+
*/
|
|
52
|
+
export function collectOpenApiOverlayConfig(docsConfig) {
|
|
53
|
+
const entries = [];
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
collectEntriesDeep(docsConfig, entries, seen);
|
|
56
|
+
const explicit = new Map();
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
if (entry.overlays == undefined)
|
|
59
|
+
continue;
|
|
60
|
+
// Collection runs on raw config before schema validation, so apply the same
|
|
61
|
+
// whitespace trimming the public openapi schema applies to these strings, and
|
|
62
|
+
// canonicalize refs so equivalent paths (overlays/a.yaml vs ./overlays/a.yaml)
|
|
63
|
+
// do not register as conflicting lists.
|
|
64
|
+
const overlays = entry.overlays.map((overlay) => normalizeOpenApiSourceKey(overlay.trim()));
|
|
65
|
+
const key = normalizeOpenApiSourceKey(entry.source.trim());
|
|
66
|
+
const existing = explicit.get(key);
|
|
67
|
+
if (existing != undefined && JSON.stringify(existing) !== JSON.stringify(overlays)) {
|
|
68
|
+
throw new Error(`OpenAPI source ${entry.source} is configured with conflicting overlay lists in docs.json: [${existing.join(', ')}] and [${overlays.join(', ')}]. Use the same overlays everywhere the source is referenced.`);
|
|
69
|
+
}
|
|
70
|
+
explicit.set(key, overlays);
|
|
71
|
+
}
|
|
72
|
+
return explicit;
|
|
73
|
+
}
|