Skip to content

Decorator APIProduces doesn't work #626

@VaultDeveloper

Description

@VaultDeveloper

I'm submitting a Potential bug


[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

I use nestjs/swagger with swagger-ui-express.
I set the decorator @ApiProduces("text/csv") but nothing is displayed in Swagger-ui.
I check the produced specs using F12 on Swagger-UI and nothing, in the specs, involved "Produces".

Expected behavior

The user can choose the Content-Type of the Response in Swagger-UI. As shown on the image below. This image is generated with YAML.
image

The GET attribute has :

produces:
        - application/json
        - text/csv

Minimal reproduction of the problem with instructions

Insert this function in a controller.

@Get('thing')
@ApiProduces("text/csv")
// @ApiProduces("text/csv", "application/json")
public test(): any {
	return {
		id: "id",
		name: "name"
	};
}

Environment

Last version.


"@nestjs/common": "^6.7.2",
"@nestjs/config": "0.0.9",
"@nestjs/core": "^6.7.2",
"@nestjs/platform-express": "^6.7.2",
"@nestjs/swagger": "^4.4.0",
"swagger-ui-express": "^4.1.4"
 
For Tooling issues:
- Platform: Windows

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions