@sdk-it/spec 0.46.3 → 0.46.5
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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/find-unique-schema-name.d.ts +2 -2
- package/dist/lib/find-unique-schema-name.d.ts.map +1 -1
- package/dist/lib/find-unique-schema-name.js.map +2 -2
- package/dist/lib/loaders/load-spec.d.ts.map +1 -1
- package/dist/lib/loaders/load-spec.js +13 -3
- package/dist/lib/loaders/load-spec.js.map +2 -2
- package/dist/lib/options.d.ts +7 -2
- package/dist/lib/options.d.ts.map +1 -1
- package/dist/lib/options.js +11 -1
- package/dist/lib/options.js.map +2 -2
- package/dist/lib/overview-docs/doc-text-utils.d.ts +0 -20
- package/dist/lib/overview-docs/doc-text-utils.d.ts.map +1 -1
- package/dist/lib/overview-docs/doc-text-utils.js +0 -37
- package/dist/lib/overview-docs/doc-text-utils.js.map +2 -2
- package/dist/lib/overview-docs/overview-docs.d.ts +8 -1
- package/dist/lib/overview-docs/overview-docs.d.ts.map +1 -1
- package/dist/lib/overview-docs/overview-docs.js +37 -12
- package/dist/lib/overview-docs/overview-docs.js.map +2 -2
- package/dist/lib/overview-docs/overview-page.d.ts +5 -0
- package/dist/lib/overview-docs/overview-page.d.ts.map +1 -0
- package/dist/lib/overview-docs/overview-page.js +60 -0
- package/dist/lib/overview-docs/overview-page.js.map +7 -0
- package/dist/lib/overview-docs/overview-sdks.d.ts +3 -0
- package/dist/lib/overview-docs/overview-sdks.d.ts.map +1 -0
- package/dist/lib/overview-docs/overview-sdks.js +42 -0
- package/dist/lib/overview-docs/overview-sdks.js.map +7 -0
- package/dist/lib/overview-docs/types.d.ts +23 -0
- package/dist/lib/overview-docs/types.d.ts.map +1 -0
- package/dist/lib/overview-docs/types.js +29 -0
- package/dist/lib/overview-docs/types.js.map +7 -0
- package/dist/lib/processing-plugins/create-default-processing-plugins.d.ts.map +1 -1
- package/dist/lib/processing-plugins/create-default-processing-plugins.js +4 -0
- package/dist/lib/processing-plugins/create-default-processing-plugins.js.map +2 -2
- package/dist/lib/processing-plugins/extract-overview-docs.d.ts.map +1 -1
- package/dist/lib/processing-plugins/extract-overview-docs.js +96 -3
- package/dist/lib/processing-plugins/extract-overview-docs.js.map +2 -2
- package/dist/lib/processing-plugins/index.d.ts +2 -0
- package/dist/lib/processing-plugins/index.d.ts.map +1 -1
- package/dist/lib/processing-plugins/index.js +2 -0
- package/dist/lib/processing-plugins/index.js.map +2 -2
- package/dist/lib/processing-plugins/normalize-request-bodies.d.ts +2 -2
- package/dist/lib/processing-plugins/normalize-request-bodies.d.ts.map +1 -1
- package/dist/lib/processing-plugins/normalize-request-bodies.js +6 -21
- package/dist/lib/processing-plugins/normalize-request-bodies.js.map +2 -2
- package/dist/lib/processing-plugins/normalize-schemas.d.ts.map +1 -1
- package/dist/lib/processing-plugins/normalize-schemas.js +10 -1
- package/dist/lib/processing-plugins/normalize-schemas.js.map +2 -2
- package/dist/lib/processing-plugins/normalize-security.d.ts +3 -0
- package/dist/lib/processing-plugins/normalize-security.d.ts.map +1 -0
- package/dist/lib/processing-plugins/normalize-security.js +142 -0
- package/dist/lib/processing-plugins/normalize-security.js.map +7 -0
- package/dist/lib/processing-plugins/resolve-security-scheme-uris.d.ts +9 -0
- package/dist/lib/processing-plugins/resolve-security-scheme-uris.d.ts.map +1 -0
- package/dist/lib/processing-plugins/resolve-security-scheme-uris.js +139 -0
- package/dist/lib/processing-plugins/resolve-security-scheme-uris.js.map +7 -0
- package/dist/lib/processing.js.map +1 -1
- package/dist/lib/sidebar.js +1 -1
- package/dist/lib/sidebar.js.map +2 -2
- package/dist/lib/types.d.ts +8 -5
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/lib/overview-docs/doc-templates.d.ts +0 -51
- package/dist/lib/overview-docs/doc-templates.d.ts.map +0 -1
- package/dist/lib/overview-docs/doc-templates.js +0 -123
- package/dist/lib/overview-docs/doc-templates.js.map +0 -7
- package/dist/lib/overview-docs/overview-intro.d.ts +0 -4
- package/dist/lib/overview-docs/overview-intro.d.ts.map +0 -1
- package/dist/lib/overview-docs/overview-intro.js +0 -82
- package/dist/lib/overview-docs/overview-intro.js.map +0 -7
- package/dist/lib/security.d.ts +0 -12
- package/dist/lib/security.d.ts.map +0 -1
- package/dist/lib/security.js +0 -78
- package/dist/lib/security.js.map +0 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AuthoredDoc = {
|
|
2
|
+
id?: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
content?: string;
|
|
6
|
+
};
|
|
7
|
+
/** An authored doc whose id has been normalized to a url-safe slug. */
|
|
8
|
+
export type ResolvedDoc = AuthoredDoc & {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
export type SdkLanguage = 'typescript' | 'python' | 'dart';
|
|
12
|
+
export type SdkDoc = {
|
|
13
|
+
language: SdkLanguage;
|
|
14
|
+
package: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const SDK_LANGUAGES: readonly SdkLanguage[];
|
|
18
|
+
/** Doc ids the apiref reserves for its own routes. */
|
|
19
|
+
export declare const RESERVED_DOC_IDS: ReadonlySet<string>;
|
|
20
|
+
export declare function isAuthoredDoc(value: unknown): value is AuthoredDoc;
|
|
21
|
+
export declare function isSdkDoc(value: unknown): value is SdkDoc;
|
|
22
|
+
export declare function slugify(value: string): string;
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAI/C,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAsB,CAAC;AAUxE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CASlE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CASxD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const SDK_LANGUAGES = [
|
|
2
|
+
"typescript",
|
|
3
|
+
"python",
|
|
4
|
+
"dart"
|
|
5
|
+
];
|
|
6
|
+
const RESERVED_DOC_IDS = /* @__PURE__ */ new Set(["embed"]);
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function isOptionalString(value) {
|
|
11
|
+
return value === void 0 || typeof value === "string";
|
|
12
|
+
}
|
|
13
|
+
function isAuthoredDoc(value) {
|
|
14
|
+
return isRecord(value) && typeof value.title === "string" && value.title.trim() !== "" && isOptionalString(value.id) && isOptionalString(value.description) && isOptionalString(value.content);
|
|
15
|
+
}
|
|
16
|
+
function isSdkDoc(value) {
|
|
17
|
+
return isRecord(value) && typeof value.language === "string" && SDK_LANGUAGES.includes(value.language) && typeof value.package === "string" && value.package.trim() !== "" && isOptionalString(value.url);
|
|
18
|
+
}
|
|
19
|
+
function slugify(value) {
|
|
20
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
RESERVED_DOC_IDS,
|
|
24
|
+
SDK_LANGUAGES,
|
|
25
|
+
isAuthoredDoc,
|
|
26
|
+
isSdkDoc,
|
|
27
|
+
slugify
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/overview-docs/types.ts"],
|
|
4
|
+
"sourcesContent": ["export type AuthoredDoc = {\n id?: string;\n title: string;\n description?: string;\n content?: string;\n};\n\n/** An authored doc whose id has been normalized to a url-safe slug. */\nexport type ResolvedDoc = AuthoredDoc & { id: string };\n\nexport type SdkLanguage = 'typescript' | 'python' | 'dart';\n\nexport type SdkDoc = {\n language: SdkLanguage;\n package: string;\n url?: string;\n};\n\nexport const SDK_LANGUAGES: readonly SdkLanguage[] = [\n 'typescript',\n 'python',\n 'dart',\n];\n\n/** Doc ids the apiref reserves for its own routes. */\nexport const RESERVED_DOC_IDS: ReadonlySet<string> = new Set(['embed']);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n return value === undefined || typeof value === 'string';\n}\n\nexport function isAuthoredDoc(value: unknown): value is AuthoredDoc {\n return (\n isRecord(value) &&\n typeof value.title === 'string' &&\n value.title.trim() !== '' &&\n isOptionalString(value.id) &&\n isOptionalString(value.description) &&\n isOptionalString(value.content)\n );\n}\n\nexport function isSdkDoc(value: unknown): value is SdkDoc {\n return (\n isRecord(value) &&\n typeof value.language === 'string' &&\n (SDK_LANGUAGES as readonly string[]).includes(value.language) &&\n typeof value.package === 'string' &&\n value.package.trim() !== '' &&\n isOptionalString(value.url)\n );\n}\n\nexport function slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n"],
|
|
5
|
+
"mappings": "AAkBO,MAAM,gBAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAAwC,oBAAI,IAAI,CAAC,OAAO,CAAC;AAEtE,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,iBAAiB,OAA6C;AACrE,SAAO,UAAU,UAAa,OAAO,UAAU;AACjD;AAEO,SAAS,cAAc,OAAsC;AAClE,SACE,SAAS,KAAK,KACd,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,KAAK,MAAM,MACvB,iBAAiB,MAAM,EAAE,KACzB,iBAAiB,MAAM,WAAW,KAClC,iBAAiB,MAAM,OAAO;AAElC;AAEO,SAAS,SAAS,OAAiC;AACxD,SACE,SAAS,KAAK,KACd,OAAO,MAAM,aAAa,YACzB,cAAoC,SAAS,MAAM,QAAQ,KAC5D,OAAO,MAAM,YAAY,YACzB,MAAM,QAAQ,KAAK,MAAM,MACzB,iBAAiB,MAAM,GAAG;AAE9B;AAEO,SAAS,QAAQ,OAAuB;AAC7C,SAAO,MACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-default-processing-plugins.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/create-default-processing-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-default-processing-plugins.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/create-default-processing-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAezD,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,gBAAgB,EAAE,CAgBpB"}
|
|
@@ -8,7 +8,9 @@ import { normalizePaths } from "./normalize-paths.js";
|
|
|
8
8
|
import { normalizeRequestBodies } from "./normalize-request-bodies.js";
|
|
9
9
|
import { normalizeResponses } from "./normalize-responses.js";
|
|
10
10
|
import { normalizeSchemas } from "./normalize-schemas.js";
|
|
11
|
+
import { normalizeSecurity } from "./normalize-security.js";
|
|
11
12
|
import { normalizeTags } from "./normalize-tags.js";
|
|
13
|
+
import { resolveSecuritySchemeUris } from "./resolve-security-scheme-uris.js";
|
|
12
14
|
function createDefaultProcessingPlugins(options = {}) {
|
|
13
15
|
return [
|
|
14
16
|
normalizePaths(),
|
|
@@ -16,6 +18,8 @@ function createDefaultProcessingPlugins(options = {}) {
|
|
|
16
18
|
normalizeTags(),
|
|
17
19
|
normalizeParameters(),
|
|
18
20
|
normalizeResponses(),
|
|
21
|
+
resolveSecuritySchemeUris(),
|
|
22
|
+
normalizeSecurity(),
|
|
19
23
|
normalizeRequestBodies(),
|
|
20
24
|
inferPagination(),
|
|
21
25
|
normalizeSchemas(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/processing-plugins/create-default-processing-plugins.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ProcessingPlugin } from '../processing.js';\nimport { canonicalizeSpec } from './canonicalize-spec.js';\nimport { extractInlineSchemas } from './extract-inline-schemas.js';\nimport { extractOverviewDocsPlugin } from './extract-overview-docs.js';\nimport { inferPagination } from './infer-pagination.js';\nimport { normalizeOperationIds } from './normalize-operation-ids.js';\nimport { normalizeParameters } from './normalize-parameters.js';\nimport { normalizePaths } from './normalize-paths.js';\nimport { normalizeRequestBodies } from './normalize-request-bodies.js';\nimport { normalizeResponses } from './normalize-responses.js';\nimport { normalizeSchemas } from './normalize-schemas.js';\nimport { normalizeTags } from './normalize-tags.js';\n\nexport function createDefaultProcessingPlugins(\n options: { verbose?: boolean } = {},\n): ProcessingPlugin[] {\n return [\n normalizePaths(),\n normalizeOperationIds(),\n normalizeTags(),\n normalizeParameters(),\n normalizeResponses(),\n normalizeRequestBodies(),\n inferPagination(),\n normalizeSchemas(),\n ...(options.verbose ? [extractInlineSchemas()] : []),\n extractOverviewDocsPlugin(),\n canonicalizeSpec(),\n ];\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import type { ProcessingPlugin } from '../processing.js';\nimport { canonicalizeSpec } from './canonicalize-spec.js';\nimport { extractInlineSchemas } from './extract-inline-schemas.js';\nimport { extractOverviewDocsPlugin } from './extract-overview-docs.js';\nimport { inferPagination } from './infer-pagination.js';\nimport { normalizeOperationIds } from './normalize-operation-ids.js';\nimport { normalizeParameters } from './normalize-parameters.js';\nimport { normalizePaths } from './normalize-paths.js';\nimport { normalizeRequestBodies } from './normalize-request-bodies.js';\nimport { normalizeResponses } from './normalize-responses.js';\nimport { normalizeSchemas } from './normalize-schemas.js';\nimport { normalizeSecurity } from './normalize-security.js';\nimport { normalizeTags } from './normalize-tags.js';\nimport { resolveSecuritySchemeUris } from './resolve-security-scheme-uris.js';\n\nexport function createDefaultProcessingPlugins(\n options: { verbose?: boolean } = {},\n): ProcessingPlugin[] {\n return [\n normalizePaths(),\n normalizeOperationIds(),\n normalizeTags(),\n normalizeParameters(),\n normalizeResponses(),\n resolveSecuritySchemeUris(),\n normalizeSecurity(),\n normalizeRequestBodies(),\n inferPagination(),\n normalizeSchemas(),\n ...(options.verbose ? [extractInlineSchemas()] : []),\n extractOverviewDocsPlugin(),\n canonicalizeSpec(),\n ];\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAEnC,SAAS,+BACd,UAAiC,CAAC,GACd;AACpB,SAAO;AAAA,IACL,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,cAAc;AAAA,IACd,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,0BAA0B;AAAA,IAC1B,kBAAkB;AAAA,IAClB,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,GAAI,QAAQ,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC;AAAA,IAClD,0BAA0B;AAAA,IAC1B,iBAAiB;AAAA,EACnB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-overview-docs.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/extract-overview-docs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-overview-docs.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/extract-overview-docs.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,wBAAgB,yBAAyB,IAAI,gBAAgB,CAa5D"}
|
|
@@ -1,12 +1,105 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
GENERATED_DOC_IDS,
|
|
3
|
+
extractOverviewDocs
|
|
4
|
+
} from "../overview-docs/overview-docs.js";
|
|
5
|
+
import {
|
|
6
|
+
RESERVED_DOC_IDS,
|
|
7
|
+
isAuthoredDoc,
|
|
8
|
+
isSdkDoc,
|
|
9
|
+
slugify
|
|
10
|
+
} from "../overview-docs/types.js";
|
|
2
11
|
function extractOverviewDocsPlugin() {
|
|
3
12
|
return {
|
|
4
13
|
name: "extract-overview-docs",
|
|
5
|
-
process(
|
|
6
|
-
|
|
14
|
+
process(context) {
|
|
15
|
+
const sdks = collectSdks(context);
|
|
16
|
+
const entries = collectDocs(context);
|
|
17
|
+
context.spec["x-sdks"] = sdks;
|
|
18
|
+
context.spec["x-docs"] = extractOverviewDocs(context.spec, {
|
|
19
|
+
entries,
|
|
20
|
+
sdks
|
|
21
|
+
});
|
|
7
22
|
}
|
|
8
23
|
};
|
|
9
24
|
}
|
|
25
|
+
function collectSdks({ options, report }) {
|
|
26
|
+
const raw = options.docs.sdks;
|
|
27
|
+
if (raw === void 0) return [];
|
|
28
|
+
if (!Array.isArray(raw)) {
|
|
29
|
+
report({
|
|
30
|
+
severity: "warning",
|
|
31
|
+
code: "invalid-x-sdks",
|
|
32
|
+
message: "x-sdks must be an array of { language, package, url? }.",
|
|
33
|
+
path: "/x-sdks"
|
|
34
|
+
});
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return raw.filter((entry, index) => {
|
|
38
|
+
if (isSdkDoc(entry)) return true;
|
|
39
|
+
report({
|
|
40
|
+
severity: "warning",
|
|
41
|
+
code: "invalid-x-sdks",
|
|
42
|
+
message: "x-sdks entries need a language of typescript, python, or dart and a package name.",
|
|
43
|
+
path: `/x-sdks/${index}`
|
|
44
|
+
});
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function collectDocs({ options, report }) {
|
|
49
|
+
const raw = options.docs.entries;
|
|
50
|
+
if (raw === void 0) return [];
|
|
51
|
+
if (!Array.isArray(raw)) {
|
|
52
|
+
report({
|
|
53
|
+
severity: "warning",
|
|
54
|
+
code: "invalid-x-docs",
|
|
55
|
+
message: "x-docs must be an array of { id?, title, description?, content? }.",
|
|
56
|
+
path: "/x-docs"
|
|
57
|
+
});
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
const docs = [];
|
|
61
|
+
const seen = /* @__PURE__ */ new Set();
|
|
62
|
+
raw.forEach((entry, index) => {
|
|
63
|
+
const path = `/x-docs/${index}`;
|
|
64
|
+
const invalid = (message) => report({ severity: "warning", code: "invalid-x-docs", message, path });
|
|
65
|
+
if (!isAuthoredDoc(entry)) {
|
|
66
|
+
invalid(
|
|
67
|
+
"x-docs entries need a title; id, description, and content must be strings."
|
|
68
|
+
);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const id = slugify(entry.id ?? entry.title);
|
|
72
|
+
if (!id) {
|
|
73
|
+
invalid(`Cannot derive a url-safe id from "${entry.id ?? entry.title}".`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (RESERVED_DOC_IDS.has(id)) {
|
|
77
|
+
report({
|
|
78
|
+
severity: "warning",
|
|
79
|
+
code: "reserved-x-docs-id",
|
|
80
|
+
message: `"${id}" is reserved by the API reference and cannot be used as a doc id.`,
|
|
81
|
+
path
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (seen.has(id)) {
|
|
86
|
+
report({
|
|
87
|
+
severity: "warning",
|
|
88
|
+
code: "duplicate-x-docs-id",
|
|
89
|
+
message: `Doc id "${id}" is used more than once; later entries are ignored.`,
|
|
90
|
+
path
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!GENERATED_DOC_IDS.has(id) && !entry.content && !entry.description) {
|
|
95
|
+
invalid(`Custom doc "${id}" needs content or a description to render.`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
seen.add(id);
|
|
99
|
+
docs.push({ ...entry, id });
|
|
100
|
+
});
|
|
101
|
+
return docs;
|
|
102
|
+
}
|
|
10
103
|
export {
|
|
11
104
|
extractOverviewDocsPlugin
|
|
12
105
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/processing-plugins/extract-overview-docs.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n GENERATED_DOC_IDS,\n extractOverviewDocs,\n} from '../overview-docs/overview-docs.js';\nimport {\n RESERVED_DOC_IDS,\n type ResolvedDoc,\n type SdkDoc,\n isAuthoredDoc,\n isSdkDoc,\n slugify,\n} from '../overview-docs/types.js';\nimport type { ProcessingContext, ProcessingPlugin } from '../processing.js';\n\nexport function extractOverviewDocsPlugin(): ProcessingPlugin {\n return {\n name: 'extract-overview-docs',\n process(context) {\n const sdks = collectSdks(context);\n const entries = collectDocs(context);\n context.spec['x-sdks'] = sdks;\n context.spec['x-docs'] = extractOverviewDocs(context.spec, {\n entries,\n sdks,\n });\n },\n };\n}\n\nfunction collectSdks({ options, report }: ProcessingContext): SdkDoc[] {\n const raw = options.docs.sdks;\n if (raw === undefined) return [];\n if (!Array.isArray(raw)) {\n report({\n severity: 'warning',\n code: 'invalid-x-sdks',\n message: 'x-sdks must be an array of { language, package, url? }.',\n path: '/x-sdks',\n });\n return [];\n }\n return raw.filter((entry: unknown, index): entry is SdkDoc => {\n if (isSdkDoc(entry)) return true;\n report({\n severity: 'warning',\n code: 'invalid-x-sdks',\n message:\n 'x-sdks entries need a language of typescript, python, or dart and a package name.',\n path: `/x-sdks/${index}`,\n });\n return false;\n });\n}\n\nfunction collectDocs({ options, report }: ProcessingContext): ResolvedDoc[] {\n const raw = options.docs.entries;\n if (raw === undefined) return [];\n if (!Array.isArray(raw)) {\n report({\n severity: 'warning',\n code: 'invalid-x-docs',\n message:\n 'x-docs must be an array of { id?, title, description?, content? }.',\n path: '/x-docs',\n });\n return [];\n }\n\n const docs: ResolvedDoc[] = [];\n const seen = new Set<string>();\n raw.forEach((entry: unknown, index) => {\n const path = `/x-docs/${index}`;\n const invalid = (message: string) =>\n report({ severity: 'warning', code: 'invalid-x-docs', message, path });\n\n if (!isAuthoredDoc(entry)) {\n invalid(\n 'x-docs entries need a title; id, description, and content must be strings.',\n );\n return;\n }\n const id = slugify(entry.id ?? entry.title);\n if (!id) {\n invalid(`Cannot derive a url-safe id from \"${entry.id ?? entry.title}\".`);\n return;\n }\n if (RESERVED_DOC_IDS.has(id)) {\n report({\n severity: 'warning',\n code: 'reserved-x-docs-id',\n message: `\"${id}\" is reserved by the API reference and cannot be used as a doc id.`,\n path,\n });\n return;\n }\n if (seen.has(id)) {\n report({\n severity: 'warning',\n code: 'duplicate-x-docs-id',\n message: `Doc id \"${id}\" is used more than once; later entries are ignored.`,\n path,\n });\n return;\n }\n if (!GENERATED_DOC_IDS.has(id) && !entry.content && !entry.description) {\n invalid(`Custom doc \"${id}\" needs content or a description to render.`);\n return;\n }\n seen.add(id);\n docs.push({ ...entry, id });\n });\n return docs;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,4BAA8C;AAC5D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ,SAAS;AACf,YAAM,OAAO,YAAY,OAAO;AAChC,YAAM,UAAU,YAAY,OAAO;AACnC,cAAQ,KAAK,QAAQ,IAAI;AACzB,cAAQ,KAAK,QAAQ,IAAI,oBAAoB,QAAQ,MAAM;AAAA,QACzD;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAA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ACA,QAAI,iBAAiB,IAAI,EAAE,GAAG;AAC5B,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,SAAS,IAAI,EAAE;AAAA,QACf;AAAA,MACF,CAAC;AACD;AAAA,IACF;AACA,QAAI,KAAK,IAAI,EAAE,GAAG;AAChB,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,SAAS,WAAW,EAAE;AAAA,QACtB;AAAA,MACF,CAAC;AACD;AAAA,IACF;AACA,QAAI,CAAC,kBAAkB,IAAI,EAAE,KAAK,CAAC,MAAM,WAAW,CAAC,MAAM,aAAa;AACtE,cAAQ,eAAe,EAAE,6CAA6C;AACtE;AAAA,IACF;AACA,SAAK,IAAI,EAAE;AACX,SAAK,KAAK,EAAE,GAAG,OAAO,GAAG,CAAC;AAAA,EAC5B,CAAC;AACD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,6 +9,8 @@ export * from './normalize-parameters.js';
|
|
|
9
9
|
export * from './normalize-paths.js';
|
|
10
10
|
export * from './normalize-request-bodies.js';
|
|
11
11
|
export * from './normalize-responses.js';
|
|
12
|
+
export * from './normalize-security.js';
|
|
12
13
|
export * from './normalize-schemas.js';
|
|
13
14
|
export * from './normalize-tags.js';
|
|
15
|
+
export * from './resolve-security-scheme-uris.js';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wCAAwC,CAAC;AACvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wCAAwC,CAAC;AACvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC"}
|
|
@@ -9,6 +9,8 @@ export * from "./normalize-parameters.js";
|
|
|
9
9
|
export * from "./normalize-paths.js";
|
|
10
10
|
export * from "./normalize-request-bodies.js";
|
|
11
11
|
export * from "./normalize-responses.js";
|
|
12
|
+
export * from "./normalize-security.js";
|
|
12
13
|
export * from "./normalize-schemas.js";
|
|
13
14
|
export * from "./normalize-tags.js";
|
|
15
|
+
export * from "./resolve-security-scheme-uris.js";
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/processing-plugins/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './canonicalize-spec.js';\nexport * from './create-default-processing-plugins.js';\nexport * from './enrich-examples.js';\nexport * from './extract-inline-schemas.js';\nexport * from './extract-overview-docs.js';\nexport * from './infer-pagination.js';\nexport * from './normalize-operation-ids.js';\nexport * from './normalize-parameters.js';\nexport * from './normalize-paths.js';\nexport * from './normalize-request-bodies.js';\nexport * from './normalize-responses.js';\nexport * from './normalize-schemas.js';\nexport * from './normalize-tags.js';\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './canonicalize-spec.js';\nexport * from './create-default-processing-plugins.js';\nexport * from './enrich-examples.js';\nexport * from './extract-inline-schemas.js';\nexport * from './extract-overview-docs.js';\nexport * from './infer-pagination.js';\nexport * from './normalize-operation-ids.js';\nexport * from './normalize-parameters.js';\nexport * from './normalize-paths.js';\nexport * from './normalize-request-bodies.js';\nexport * from './normalize-responses.js';\nexport * from './normalize-security.js';\nexport * from './normalize-schemas.js';\nexport * from './normalize-tags.js';\nexport * from './resolve-security-scheme-uris.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ParameterObject, SchemaObject
|
|
1
|
+
import type { ParameterObject, SchemaObject } from 'openapi3-ts/oas31';
|
|
2
2
|
import type { ProcessingPlugin } from '../processing.js';
|
|
3
3
|
import type { IR } from '../types.js';
|
|
4
|
-
export declare function patchParameters(spec: IR, schema: SchemaObject, parameters: ParameterObject[]
|
|
4
|
+
export declare function patchParameters(spec: IR, schema: SchemaObject, parameters: ParameterObject[]): void;
|
|
5
5
|
export declare function normalizeRequestBodies(): ProcessingPlugin;
|
|
6
6
|
//# sourceMappingURL=normalize-request-bodies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-request-bodies.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/normalize-request-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEf,YAAY,
|
|
1
|
+
{"version":3,"file":"normalize-request-bodies.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/normalize-request-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEf,YAAY,EACb,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EACV,EAAE,EAGH,MAAM,aAAa,CAAC;AAErB,wBAAgB,eAAe,CAC7B,IAAI,EAAE,EAAE,EACR,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,eAAe,EAAE,QAkB9B;AA8ED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAsCzD"}
|
|
@@ -2,13 +2,7 @@ import { followRef, isRef, resolveRef } from "@sdk-it/core/ref.js";
|
|
|
2
2
|
import { isEmpty } from "@sdk-it/core/utils.js";
|
|
3
3
|
import { findUniqueSchemaName } from "../find-unique-schema-name.js";
|
|
4
4
|
import { iterateOperations } from "../for-each-operation.js";
|
|
5
|
-
|
|
6
|
-
function patchParameters(spec, schema, parameters, security) {
|
|
7
|
-
const securityOptions = securityToOptions(
|
|
8
|
-
spec,
|
|
9
|
-
security,
|
|
10
|
-
spec.components.securitySchemes
|
|
11
|
-
);
|
|
5
|
+
function patchParameters(spec, schema, parameters) {
|
|
12
6
|
const required = new Set(
|
|
13
7
|
Array.isArray(schema.required) ? schema.required : []
|
|
14
8
|
);
|
|
@@ -22,16 +16,9 @@ function patchParameters(spec, schema, parameters, security) {
|
|
|
22
16
|
...isRef(param.schema) ? followRef(spec, param.schema.$ref) : param.schema ?? { type: "string" }
|
|
23
17
|
};
|
|
24
18
|
}
|
|
25
|
-
for (const param of securityOptions) {
|
|
26
|
-
required.delete(param.name);
|
|
27
|
-
schema["x-properties"][param.name] = {
|
|
28
|
-
"x-in": "header",
|
|
29
|
-
...isRef(param.schema) ? followRef(spec, param.schema.$ref) : param.schema ?? { type: "string" }
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
19
|
schema["x-required"] = [...required];
|
|
33
20
|
}
|
|
34
|
-
function normalizeRequestBody(spec, operationId, operation, parameters
|
|
21
|
+
function normalizeRequestBody(spec, operationId, operation, parameters) {
|
|
35
22
|
const requestBodySource = isRef(operation.requestBody) ? followRef(spec, operation.requestBody.$ref) : operation.requestBody ?? {
|
|
36
23
|
content: {},
|
|
37
24
|
required: false
|
|
@@ -47,7 +34,7 @@ function normalizeRequestBody(spec, operationId, operation, parameters, security
|
|
|
47
34
|
"x-inputname": inputName,
|
|
48
35
|
"x-requestbody": true
|
|
49
36
|
};
|
|
50
|
-
patchParameters(spec, schema, parameters
|
|
37
|
+
patchParameters(spec, schema, parameters);
|
|
51
38
|
const normalized = {
|
|
52
39
|
...requestBody,
|
|
53
40
|
content: {
|
|
@@ -83,7 +70,7 @@ function normalizeRequestBody(spec, operationId, operation, parameters, security
|
|
|
83
70
|
schema = structuredClone(mediaType.schema);
|
|
84
71
|
break;
|
|
85
72
|
}
|
|
86
|
-
patchParameters(spec, schema, parameters
|
|
73
|
+
patchParameters(spec, schema, parameters);
|
|
87
74
|
spec.components.schemas[inputName] = {
|
|
88
75
|
...schema,
|
|
89
76
|
"x-requestbody": true,
|
|
@@ -114,8 +101,7 @@ function normalizeRequestBodies() {
|
|
|
114
101
|
patchParameters(
|
|
115
102
|
spec,
|
|
116
103
|
schema,
|
|
117
|
-
tunedOperation.parameters
|
|
118
|
-
operation.security ?? []
|
|
104
|
+
tunedOperation.parameters
|
|
119
105
|
);
|
|
120
106
|
}
|
|
121
107
|
continue;
|
|
@@ -125,8 +111,7 @@ function normalizeRequestBodies() {
|
|
|
125
111
|
spec,
|
|
126
112
|
tunedOperation.operationId,
|
|
127
113
|
operation,
|
|
128
|
-
tunedOperation.parameters
|
|
129
|
-
operation.security ?? []
|
|
114
|
+
tunedOperation.parameters
|
|
130
115
|
);
|
|
131
116
|
}
|
|
132
117
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/processing-plugins/normalize-request-bodies.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n OperationObject,\n ParameterObject,\n RequestBodyObject,\n SchemaObject,\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type {\n OperationObject,\n ParameterObject,\n RequestBodyObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef, resolveRef } from '@sdk-it/core/ref.js';\nimport { isEmpty } from '@sdk-it/core/utils.js';\n\nimport { findUniqueSchemaName } from '../find-unique-schema-name.js';\nimport { iterateOperations } from '../for-each-operation.js';\nimport type { ProcessingPlugin } from '../processing.js';\nimport type {\n IR,\n OurRequestBodyObject,\n TunedOperationObject,\n} from '../types.js';\n\nexport function patchParameters(\n spec: IR,\n schema: SchemaObject,\n parameters: ParameterObject[],\n) {\n const required = new Set(\n Array.isArray(schema.required) ? schema.required : [],\n );\n schema['x-properties'] ??= {};\n for (const param of parameters) {\n if (param.required) {\n required.add(param.name);\n }\n schema['x-properties'][param.name] = {\n 'x-in': param.in,\n ...(isRef(param.schema)\n ? followRef<SchemaObject>(spec, param.schema.$ref)\n : (param.schema ?? { type: 'string' })),\n };\n }\n schema['x-required'] = [...required];\n}\n\nfunction normalizeRequestBody(\n spec: IR,\n operationId: string,\n operation: OperationObject,\n parameters: ParameterObject[],\n): OurRequestBodyObject {\n const requestBodySource = isRef(operation.requestBody)\n ? followRef<RequestBodyObject>(spec, operation.requestBody.$ref)\n : (operation.requestBody ?? {\n content: {},\n required: false,\n });\n const requestBody = structuredClone(requestBodySource);\n if (isEmpty(requestBody.content)) {\n const inputName = findUniqueSchemaName(spec, operationId, [\n 'input',\n 'payload',\n 'request',\n ]);\n const schema: SchemaObject = {\n 'x-inputname': inputName,\n 'x-requestbody': true,\n };\n patchParameters(spec, schema, parameters);\n const normalized: OurRequestBodyObject = {\n ...requestBody,\n content: {\n 'application/empty': {\n schema: { $ref: `#/components/schemas/${inputName}` },\n },\n },\n };\n\n spec.components.schemas[inputName] = schema;\n return normalized;\n }\n for (const contentType in requestBody.content) {\n const mediaType = requestBody.content[contentType];\n const inputName = findUniqueSchemaName(spec, operationId, [\n 'input',\n 'payload',\n 'request',\n ]);\n let schema: SchemaObject | undefined;\n\n switch (true) {\n case isRef(mediaType.schema):\n schema = structuredClone(\n followRef<SchemaObject>(spec, mediaType.schema.$ref),\n );\n break;\n case isEmpty(mediaType.schema):\n schema ??= {};\n console.warn(\n `Request body schema for content type \"${contentType}\" is empty.`,\n );\n break;\n default:\n schema = structuredClone(mediaType.schema);\n break;\n }\n\n patchParameters(spec, schema, parameters);\n spec.components.schemas[inputName] = {\n ...schema,\n 'x-requestbody': true,\n 'x-inputname': inputName,\n };\n\n requestBody.content[contentType].schema = {\n $ref: `#/components/schemas/${inputName}`,\n };\n }\n return requestBody as OurRequestBodyObject;\n}\n\nexport function normalizeRequestBodies(): ProcessingPlugin {\n return {\n name: 'normalize-request-bodies',\n process({ spec }) {\n for (const { operation } of iterateOperations(spec)) {\n const tunedOperation = operation as TunedOperationObject;\n if (operation.requestBody) {\n const requestBody = resolveRef<RequestBodyObject>(\n spec,\n operation.requestBody,\n );\n const schemas = Object.values(requestBody.content).map(\n ({ schema }) =>\n schema ? resolveRef<SchemaObject>(spec, schema) : undefined,\n );\n if (\n schemas.length > 0 &&\n schemas.every((schema) => schema?.['x-requestbody'])\n ) {\n for (const schema of new Set(schemas)) {\n patchParameters(\n spec,\n schema as SchemaObject,\n tunedOperation.parameters,\n );\n }\n continue;\n }\n }\n tunedOperation.requestBody = normalizeRequestBody(\n spec,\n tunedOperation.operationId,\n operation,\n tunedOperation.parameters,\n );\n }\n },\n };\n}\n"],
|
|
5
|
+
"mappings": "AAOA,SAAS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AAA,gBACE;AAAA,gBACA;AAAA,gBACA,eAAe;AAAA,cACjB;AAAA,YACF;AACA;AAAA,UACF;AAAA,QACF;AACA,uBAAe,cAAc;AAAA,UAC3B;AAAA,UACA,eAAe;AAAA,UACf;AAAA,UACA,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/normalize-schemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/processing-plugins/normalize-schemas.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AA2LzD,wBAAgB,gBAAgB,IAAI,gBAAgB,CAOnD"}
|
|
@@ -4,6 +4,7 @@ import { isEmpty, isRef, notRef, resolveRef, snakecase } from "@sdk-it/core";
|
|
|
4
4
|
import { findVarients } from "../find-polymorphic-varients.js";
|
|
5
5
|
import { formatName } from "../format-name.js";
|
|
6
6
|
import { isPrimitiveSchema } from "../is-primitive-schema.js";
|
|
7
|
+
import { coerceTypes } from "../is.js";
|
|
7
8
|
function normalizeSchemaObjects(spec, schemas, visited = /* @__PURE__ */ new Set()) {
|
|
8
9
|
for (const schema of schemas) {
|
|
9
10
|
if (isRef(schema)) continue;
|
|
@@ -145,8 +146,16 @@ function normalizeSchemaObjects(spec, schemas, visited = /* @__PURE__ */ new Set
|
|
|
145
146
|
(item) => resolveRef(spec, item).type !== "null"
|
|
146
147
|
);
|
|
147
148
|
if (otherTypes.length === 1) {
|
|
148
|
-
|
|
149
|
+
const [only] = otherTypes;
|
|
150
|
+
const droppedNull = otherTypes.length !== schema[kind].length;
|
|
151
|
+
Object.assign(schema, only);
|
|
149
152
|
delete schema[kind];
|
|
153
|
+
if (droppedNull && notRef(only)) {
|
|
154
|
+
const types = coerceTypes(only, false);
|
|
155
|
+
if (types.length) {
|
|
156
|
+
schema.type = uniq([...types, "null"]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
150
159
|
continue;
|
|
151
160
|
}
|
|
152
161
|
schema["x-varients"] = findVarients(spec, schema[kind]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/processing-plugins/normalize-schemas.ts"],
|
|
4
|
-
"sourcesContent": ["import { merge, uniq } from 'lodash-es';\nimport assert from 'node:assert';\nimport type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { isEmpty, isRef, notRef, resolveRef, snakecase } from '@sdk-it/core';\n\nimport { findVarients } from '../find-polymorphic-varients.js';\nimport { formatName } from '../format-name.js';\nimport { isPrimitiveSchema } from '../is-primitive-schema.js';\nimport type { ProcessingPlugin } from '../processing.js';\nimport type { IR } from '../types.js';\n\nfunction normalizeSchemaObjects(\n spec: IR,\n schemas: (SchemaObject | ReferenceObject)[],\n visited = new Set<string>(),\n) {\n for (const schema of schemas) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n schema.type = 'object';\n delete schema.oneOf;\n delete schema.anyOf;\n normalizeSchemaObjects(spec, Object.values(schema.properties), visited);\n for (const [key, value] of Object.entries(schema.properties)) {\n if (notRef(value) && isPrimitiveSchema(value)) {\n value.default ??= schema.default?.[key];\n delete schema.default?.[key];\n }\n }\n delete schema.default;\n }\n\n if (!isEmpty(schema['x-properties'])) {\n normalizeSchemaObjects(\n spec,\n Object.values(schema['x-properties']),\n visited,\n );\n }\n\n if (!isEmpty(schema.items)) {\n delete schema.oneOf;\n delete schema.anyOf;\n schema.type = 'array';\n normalizeSchemaObjects(spec, [schema.items], visited);\n const items = resolveRef<SchemaObject>(spec, schema.items);\n if (Array.isArray(items.default)) {\n schema.default ??= structuredClone(items.default);\n }\n delete items.default;\n }\n\n if (!isEmpty(schema.anyOf) && !isEmpty(schema.oneOf)) {\n delete schema.anyOf;\n }\n\n if (isEmpty(schema.enum)) {\n delete schema.enum;\n }\n\n if (!isEmpty(schema.enum)) {\n if (schema.enum.length === 1) {\n schema.const = schema.enum[0];\n delete schema.enum;\n } else {\n const valuesSet = new Set<string>();\n const valuesList = [];\n for (const value of schema.enum) {\n const formattedValue = formatName(snakecase(formatName(value)));\n if (!valuesSet.has(formattedValue)) {\n valuesSet.add(formattedValue);\n valuesList.push(value);\n }\n }\n schema.enum = valuesList;\n }\n delete schema.allOf;\n }\n\n if (schema.const !== undefined) {\n schema.default = schema.const;\n }\n\n if (!isEmpty(schema.allOf)) {\n const schemas = schema.allOf;\n const resolved = schemas.map((item) =>\n resolveRef<SchemaObject>(spec, item),\n );\n const hasObjects = resolved.some((item) => item.type === 'object');\n const hasOtherTypes = resolved.some(\n (item) => item.type && item.type !== 'object',\n );\n if (hasObjects && hasOtherTypes) {\n assert(false, `allOf must be an object`);\n }\n merge(\n schema,\n ...resolved.map((resolvedSchema, index) => {\n const sourceSchema = schemas[index];\n if (isRef(sourceSchema)) {\n if (visited.has(sourceSchema.$ref)) {\n throw new Error(\n `Circular allOf reference detected: ${[\n ...visited,\n sourceSchema.$ref,\n ].join(' -> ')}`,\n );\n }\n normalizeSchemaObjects(\n spec,\n [resolvedSchema],\n new Set(visited).add(sourceSchema.$ref),\n );\n } else {\n normalizeSchemaObjects(spec, [resolvedSchema], visited);\n }\n return resolvedSchema;\n }),\n );\n delete schema.allOf;\n } else {\n delete schema.allOf;\n }\n\n if (\n schema.type === 'object' &&\n isEmpty(schema.properties) &&\n typeof schema.additionalProperties === 'object' &&\n !isEmpty(schema.additionalProperties) &&\n notRef(schema.additionalProperties) &&\n !isEmpty(schema.additionalProperties.properties)\n ) {\n normalizeSchemaObjects(\n spec,\n Object.values(schema.additionalProperties.properties),\n visited,\n );\n }\n\n for (const kind of ['oneOf', 'anyOf'] as const) {\n if (!isEmpty(schema[kind])) {\n delete schema.type;\n normalizeSchemaObjects(spec, schema[kind], visited);\n if (isEmpty(schema[kind])) {\n continue;\n }\n\n let enumSchemaIndex = -1;\n const enumValues: string[] = [];\n for (let index = 0; index < schema[kind].length; index++) {\n const item = schema[kind][index];\n if (notRef(item) && item.type === 'string') {\n if (item.enum && item.enum.length > 1) {\n enumValues.push(...item.enum);\n if (enumSchemaIndex === -1) {\n enumSchemaIndex = index;\n }\n }\n }\n }\n if (enumSchemaIndex !== -1) {\n const enumSchema = schema[kind][enumSchemaIndex];\n if (notRef(enumSchema)) {\n enumSchema.enum = uniq(enumValues);\n }\n schema[kind] = schema[kind].filter(\n (item, index) => index === enumSchemaIndex || isRef(item),\n );\n }\n const otherTypes = schema[kind].filter(\n (item) => resolveRef<SchemaObject>(spec, item).type !== 'null',\n );\n if (otherTypes.length === 1) {\n Object.assign(schema,
|
|
5
|
-
"mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,OAAO,YAAY;AAGnB,SAAS,SAAS,OAAO,QAAQ,YAAY,iBAAiB;AAE9D,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;
|
|
4
|
+
"sourcesContent": ["import { merge, uniq } from 'lodash-es';\nimport assert from 'node:assert';\nimport type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { isEmpty, isRef, notRef, resolveRef, snakecase } from '@sdk-it/core';\n\nimport { findVarients } from '../find-polymorphic-varients.js';\nimport { formatName } from '../format-name.js';\nimport { isPrimitiveSchema } from '../is-primitive-schema.js';\nimport { coerceTypes } from '../is.js';\nimport type { ProcessingPlugin } from '../processing.js';\nimport type { IR } from '../types.js';\n\nfunction normalizeSchemaObjects(\n spec: IR,\n schemas: (SchemaObject | ReferenceObject)[],\n visited = new Set<string>(),\n) {\n for (const schema of schemas) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n schema.type = 'object';\n delete schema.oneOf;\n delete schema.anyOf;\n normalizeSchemaObjects(spec, Object.values(schema.properties), visited);\n for (const [key, value] of Object.entries(schema.properties)) {\n if (notRef(value) && isPrimitiveSchema(value)) {\n value.default ??= schema.default?.[key];\n delete schema.default?.[key];\n }\n }\n delete schema.default;\n }\n\n if (!isEmpty(schema['x-properties'])) {\n normalizeSchemaObjects(\n spec,\n Object.values(schema['x-properties']),\n visited,\n );\n }\n\n if (!isEmpty(schema.items)) {\n delete schema.oneOf;\n delete schema.anyOf;\n schema.type = 'array';\n normalizeSchemaObjects(spec, [schema.items], visited);\n const items = resolveRef<SchemaObject>(spec, schema.items);\n if (Array.isArray(items.default)) {\n schema.default ??= structuredClone(items.default);\n }\n delete items.default;\n }\n\n if (!isEmpty(schema.anyOf) && !isEmpty(schema.oneOf)) {\n delete schema.anyOf;\n }\n\n if (isEmpty(schema.enum)) {\n delete schema.enum;\n }\n\n if (!isEmpty(schema.enum)) {\n if (schema.enum.length === 1) {\n schema.const = schema.enum[0];\n delete schema.enum;\n } else {\n const valuesSet = new Set<string>();\n const valuesList = [];\n for (const value of schema.enum) {\n const formattedValue = formatName(snakecase(formatName(value)));\n if (!valuesSet.has(formattedValue)) {\n valuesSet.add(formattedValue);\n valuesList.push(value);\n }\n }\n schema.enum = valuesList;\n }\n delete schema.allOf;\n }\n\n if (schema.const !== undefined) {\n schema.default = schema.const;\n }\n\n if (!isEmpty(schema.allOf)) {\n const schemas = schema.allOf;\n const resolved = schemas.map((item) =>\n resolveRef<SchemaObject>(spec, item),\n );\n const hasObjects = resolved.some((item) => item.type === 'object');\n const hasOtherTypes = resolved.some(\n (item) => item.type && item.type !== 'object',\n );\n if (hasObjects && hasOtherTypes) {\n assert(false, `allOf must be an object`);\n }\n merge(\n schema,\n ...resolved.map((resolvedSchema, index) => {\n const sourceSchema = schemas[index];\n if (isRef(sourceSchema)) {\n if (visited.has(sourceSchema.$ref)) {\n throw new Error(\n `Circular allOf reference detected: ${[\n ...visited,\n sourceSchema.$ref,\n ].join(' -> ')}`,\n );\n }\n normalizeSchemaObjects(\n spec,\n [resolvedSchema],\n new Set(visited).add(sourceSchema.$ref),\n );\n } else {\n normalizeSchemaObjects(spec, [resolvedSchema], visited);\n }\n return resolvedSchema;\n }),\n );\n delete schema.allOf;\n } else {\n delete schema.allOf;\n }\n\n if (\n schema.type === 'object' &&\n isEmpty(schema.properties) &&\n typeof schema.additionalProperties === 'object' &&\n !isEmpty(schema.additionalProperties) &&\n notRef(schema.additionalProperties) &&\n !isEmpty(schema.additionalProperties.properties)\n ) {\n normalizeSchemaObjects(\n spec,\n Object.values(schema.additionalProperties.properties),\n visited,\n );\n }\n\n for (const kind of ['oneOf', 'anyOf'] as const) {\n if (!isEmpty(schema[kind])) {\n delete schema.type;\n normalizeSchemaObjects(spec, schema[kind], visited);\n if (isEmpty(schema[kind])) {\n continue;\n }\n\n let enumSchemaIndex = -1;\n const enumValues: string[] = [];\n for (let index = 0; index < schema[kind].length; index++) {\n const item = schema[kind][index];\n if (notRef(item) && item.type === 'string') {\n if (item.enum && item.enum.length > 1) {\n enumValues.push(...item.enum);\n if (enumSchemaIndex === -1) {\n enumSchemaIndex = index;\n }\n }\n }\n }\n if (enumSchemaIndex !== -1) {\n const enumSchema = schema[kind][enumSchemaIndex];\n if (notRef(enumSchema)) {\n enumSchema.enum = uniq(enumValues);\n }\n schema[kind] = schema[kind].filter(\n (item, index) => index === enumSchemaIndex || isRef(item),\n );\n }\n const otherTypes = schema[kind].filter(\n (item) => resolveRef<SchemaObject>(spec, item).type !== 'null',\n );\n if (otherTypes.length === 1) {\n const [only] = otherTypes;\n const droppedNull = otherTypes.length !== schema[kind].length;\n Object.assign(schema, only);\n delete schema[kind];\n if (droppedNull && notRef(only)) {\n const types = coerceTypes(only, false);\n if (types.length) {\n schema.type = uniq([...types, 'null']);\n }\n }\n continue;\n }\n\n schema['x-varients'] = findVarients(spec, schema[kind]);\n } else {\n delete schema[kind];\n }\n }\n }\n}\n\nexport function normalizeSchemas(): ProcessingPlugin {\n return {\n name: 'normalize-schemas',\n process({ spec }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/normalize-security.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,wBAAgB,iBAAiB,IAAI,gBAAgB,CAuEpD"}
|