diff --git a/packages/openapi-generator/src/optimize.ts b/packages/openapi-generator/src/optimize.ts index 0c08d423..510aad68 100644 --- a/packages/openapi-generator/src/optimize.ts +++ b/packages/openapi-generator/src/optimize.ts @@ -68,7 +68,9 @@ function mergeUnions(schema: Schema): Schema { return { type: 'union', - schemas: Array.from(resultingSchemas).map((s) => JSON.parse(s)), + schemas: Array.from(resultingSchemas) + .filter((s) => s != undefined) + .map((s) => JSON.parse(s)), }; }