diff --git a/lib/decorators/api-property.decorator.ts b/lib/decorators/api-property.decorator.ts index 5f5fe7416..6d239a20c 100644 --- a/lib/decorators/api-property.decorator.ts +++ b/lib/decorators/api-property.decorator.ts @@ -8,6 +8,7 @@ export interface ApiPropertyOptions name?: string; enum?: any[] | Record | (() => (any[] | Record)); enumName?: string; + 'x-enumNames'?: string[] } const isEnumArray = (obj: ApiPropertyOptions): boolean => diff --git a/lib/services/schema-object-factory.ts b/lib/services/schema-object-factory.ts index c0d786be1..15d5d2a84 100644 --- a/lib/services/schema-object-factory.ts +++ b/lib/services/schema-object-factory.ts @@ -288,7 +288,8 @@ export class SchemaObjectFactory { (param.isArray ? param.schema?.['items']?.['type'] : param.schema?.['type']) ?? 'string', - enum: _enum + enum: _enum, + ...(param['x-enumNames'] ? {'x-enumNames': param['x-enumNames']} : {}) }; } @@ -297,7 +298,7 @@ export class SchemaObjectFactory { ? { type: 'array', items: { $ref } } : { $ref }; - return omit(param, ['isArray', 'items', 'enumName', 'enum']); + return omit(param, ['isArray', 'items', 'enumName', 'enum', 'x-enumNames']); } createEnumSchemaType(