From 1db1ce804cbb6976161828329ce6153ac5c29cd0 Mon Sep 17 00:00:00 2001 From: Kiri111enz Date: Tue, 30 Jan 2024 15:41:33 +0300 Subject: [PATCH] fix return type w/out refs --- src/__snapshots__/examples/array.test.ts.snap | 4 ++-- src/includer/traverse/tables.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/__snapshots__/examples/array.test.ts.snap b/src/__snapshots__/examples/array.test.ts.snap index 7c382be..8d4d736 100644 --- a/src/__snapshots__/examples/array.test.ts.snap +++ b/src/__snapshots__/examples/array.test.ts.snap @@ -199,8 +199,8 @@ Generated server url{.openapi__request__description} #||| **Name** | **Type** | **Description** || -|| a | string -or integer[] | |||# +|| a | (string +or integer)[] | |||# ## Responses diff --git a/src/includer/traverse/tables.ts b/src/includer/traverse/tables.ts index 285014b..cf31089 100644 --- a/src/includer/traverse/tables.ts +++ b/src/includer/traverse/tables.ts @@ -157,7 +157,10 @@ export function prepareTableRowData( }; } - const returnType = (inner.ref?.length || 0) <= 1 ? `${inner.type}[]` : `(${inner.type})[]`; + const returnType = + (inner.ref?.length || inner.type.split('\n').length || 0) <= 1 + ? `${inner.type}[]` + : `(${inner.type})[]`; return { type: returnType,