From e37324346c147a74ffaa42c7788d66be6bb0f75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gr=C3=A9goire?= Date: Thu, 30 Nov 2023 18:40:11 +0000 Subject: [PATCH] fix: using $ref for enums on parameters --- lib/services/schema-object-factory.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/services/schema-object-factory.ts b/lib/services/schema-object-factory.ts index bf42e9d7a..9573248f6 100644 --- a/lib/services/schema-object-factory.ts +++ b/lib/services/schema-object-factory.ts @@ -51,6 +51,9 @@ export class SchemaObjectFactory { undefined ) as [Type, boolean]; } + if (!isBodyParameter(param) && param.enumName) { + return this.createEnumParam(param, schemas); + } if (this.isPrimitiveType(param.type)) { return param; } @@ -89,14 +92,10 @@ export class SchemaObjectFactory { return flatten(parameterObjects); } - createQueryOrParamSchema( + private createQueryOrParamSchema( param: ParamWithTypeMetadata, schemas: Record ) { - if (param.enumName) { - return this.createEnumParam(param, schemas); - } - if (isDateCtor(param.type as Function)) { return { format: 'date-time',