Skip to content

Commit 0ba48ab

Browse files
committed
feat: handle booleans
1 parent a969726 commit 0ba48ab

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/process-schema.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,17 @@ export function registerTypesFromSchema(
342342
typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias);
343343
}
344344

345+
// deal with boolean things
346+
else if (schemaObject.type === 'boolean') {
347+
const typeAlias = typesFile.addTypeAlias({
348+
name: pascalCase(schemaName),
349+
isExported: true,
350+
type: withNullUnion('boolean', schemaObject.nullable),
351+
});
352+
353+
typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias);
354+
}
355+
345356
// deal with arrays of refs
346357
else if (schemaObject.type === 'array' && '$ref' in schemaObject.items) {
347358
const iface = typesAndInterfaces.get(schemaObject.items.$ref);

0 commit comments

Comments
 (0)