Skip to content

Commit 45c119c

Browse files
committed
fix: add support for anonymous object arrays, avoiding stringifying and emitting codewriter functions
1 parent 3e69b5e commit 45c119c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/process-schema.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import camelcase from 'camelcase';
22
import type $RefParser from 'json-schema-ref-parser';
33
import type { OpenAPIV3 } from 'openapi-types';
44
import {
5+
CodeBlockWriter,
56
EnumDeclaration,
67
InterfaceDeclaration,
78
OptionalKind,
@@ -54,6 +55,19 @@ export function schemaToType(
5455
schemaObject.items,
5556
);
5657

58+
if (type.type instanceof Function) {
59+
const typeWriter = type.type;
60+
return {
61+
name,
62+
hasQuestionToken,
63+
type: (writer: CodeBlockWriter) => {
64+
writer.write('Array<');
65+
typeWriter(writer);
66+
writer.write('>');
67+
},
68+
};
69+
}
70+
5771
return {
5872
name,
5973
hasQuestionToken,

0 commit comments

Comments
 (0)