Skip to content

Commit 4d0866e

Browse files
committed
wip
1 parent ae164a5 commit 4d0866e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/openapi-typescript/src/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,22 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
122122

123123
const rootTypes = transformSchema(allSchemas["."].schema as OpenAPI3, ctx);
124124
for (const k of Object.keys(rootTypes)) {
125+
console.log("🚀 ~ file: index.ts:109 ~ k:", k);
125126
if (rootTypes[k] && !EMPTY_OBJECT_RE.test(rootTypes[k])) {
126127
output.push(options.exportType ? `export type ${k} = ${rootTypes[k]};` : `export interface ${k} ${rootTypes[k]}`, "");
127128
} else {
128129
output.push(`export type ${k} = Record<string, never>;`, "");
129130
}
131+
132+
if (options.rootTypes) {
133+
if (k === "components") {
134+
console.log(typeof rootTypes[k]);
135+
// for (const element of rootTypes[k]) {
136+
// console.log("🚀 ~ file: index.ts:119 ~ element:", element);
137+
// }
138+
}
139+
}
140+
130141
delete rootTypes[k];
131142
delete allSchemas["."]; // garbage collect, but also remove from next step (external)
132143
}

0 commit comments

Comments
 (0)