I have a simple NestJS application. I have several endpoints, and I have documented them using Swagger. Below is a code snippet:
@Get()
@ApiQuery({ name: 'search', required: false, description: 'Search term to filter items' })
@ApiQuery({ name: 'limit', required: false, description: 'Number of items to return', type: Number })
getItems(
@Query('search') search?: string,
@Query('limit') limit?: number,
) {
// Endpoint logic here
return this.carService.find(request);
}
Now, what I’m wondering is: is it possible to localize the description values of the @ApiQuery decorators? I want those descriptions to appear either in English and Spanish on my Swagger UI.
I tried internationalizing the strings (using an I18n library) and passing the values to the decorators dynamically, but apparently you can’t do that. Any help would be appreciated.