From 2d8d20b5f2f579eb8b9d4b896616d7efd12758c8 Mon Sep 17 00:00:00 2001 From: dphuang2 Date: Fri, 29 Mar 2024 16:14:10 -0700 Subject: [PATCH] if no examples, return any type in "generateAndMergeSchemaObjects" --- .../konfig-lib/src/util/generate-and-merge-schema-objects.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator/konfig-dash/packages/konfig-lib/src/util/generate-and-merge-schema-objects.ts b/generator/konfig-dash/packages/konfig-lib/src/util/generate-and-merge-schema-objects.ts index 5f8b09aaa..dde11e663 100644 --- a/generator/konfig-dash/packages/konfig-lib/src/util/generate-and-merge-schema-objects.ts +++ b/generator/konfig-dash/packages/konfig-lib/src/util/generate-and-merge-schema-objects.ts @@ -12,13 +12,16 @@ export function generateAndMergeSchemaObjects({ }: { examples: Json[] version: OpenApiVersion -}) { +}): SchemaOrReference { const exampleSchemaObjects: SchemaOrReference[] = examples.map((example) => generateSchemaObjectFromJson({ json: example, version, }) ) + if (exampleSchemaObjects.length === 0) { + return {} + } const mergedSchemaObject = exampleSchemaObjects.reduce((a, b) => mergeSchemaObject({ a, b }) )