nanogiants / nestjs-swagger-api-exception-decorator

NestJS Swagger decorator for API exceptions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swagger annotated classes with template property

jsproede opened this issue · comments

@lzkill You're right. We'll take a look at this, because currently the type is attached to message. It would be a breaking change if we'd release a new version which uses the type as main example/schema value :)

What do you think, if you'd be able to specify the class as template property? For example:

@ApiException(() => ValidationFailedException, { template: () => BaseExceptionTemplate })

You would still be able to specify the template with a JSON object. For example:

@ApiException(() => ValidationFailedException, { template: { statusCode: '$status', ... } })

Additionally, this would enable the usage of annotated classes when using buildTemplatedApiExceptionDecorator :)

Originally posted by @jsproede in #16 (comment)