Skip to content

Commit 6d79df0

Browse files
committed
ça marche mdr, mais sans indentation
1 parent efbc449 commit 6d79df0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/openapi-typescript/src/transform/components-object.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ export default function transformComponentsObject(components: ComponentsObject,
1212
const output: string[] = ["{"];
1313
indentLv++;
1414

15+
let allTypes = "";
16+
1517
// schemas
1618
if (components.schemas) {
1719
output.push(indent("schemas: {", indentLv));
1820
indentLv++;
1921
for (const [name, schemaObject] of getEntries(components.schemas, ctx.alphabetize, ctx.excludeDeprecated)) {
2022
const c = getSchemaObjectComment(schemaObject, indentLv);
23+
2124
if (c) output.push(indent(c, indentLv));
2225
let key = escObjKey(name);
2326
if (ctx.immutableTypes || schemaObject.readOnly) key = tsReadonly(key);
2427
const schemaType = transformSchemaObject(schemaObject, {
2528
path: `#/components/schemas/${name}`,
2629
ctx: { ...ctx, indentLv: indentLv },
2730
});
31+
32+
allTypes = `${allTypes}\n export type ${name} = ${schemaType};`;
33+
2834
output.push(indent(`${key}: ${schemaType};`, indentLv));
2935
}
3036
indentLv--;

0 commit comments

Comments
 (0)