swagger
swagger copied to clipboard
Support `examples` field in `@ApiHeader`
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Closes #3036
What is the new behavior?
Setting the examples field in @ApiHeader will produce the example dropdown for that field in the swagger docs.
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Based on the source for @ApiParam and @ApiQuery, it seems unlikely that those would have the same problem because they spread the options into the docs, perhaps that would also be appropriate more than hand picking the fields as is done for @ApiHeader. Especially knowing that you can spread with the omit helper.
lgtm