From d5574cd744886219a689b7c121c7cf8fe7c5e786 Mon Sep 17 00:00:00 2001 From: Daniel Belchenko <62106546+danyadanch@users.noreply.github.com> Date: Fri, 24 May 2024 03:15:32 +0300 Subject: [PATCH] fix: correct-enum-handling (#1386) --- packages/core/src/getters/discriminators.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/getters/discriminators.ts b/packages/core/src/getters/discriminators.ts index 7fdb3c30f..3f48fe52c 100644 --- a/packages/core/src/getters/discriminators.ts +++ b/packages/core/src/getters/discriminators.ts @@ -35,7 +35,11 @@ export const resolveDiscriminators = ( ...subTypeSchema.properties, [propertyName]: { type: 'string', - enum: [...(property?.enum ?? []), mappingKey], + enum: [ + ...(property?.enum?.filter((value) => value !== mappingKey) ?? + []), + mappingKey, + ], }, }; subTypeSchema.required = [