swagger
swagger copied to clipboard
feat(swagger): JSON and YAML document endpoints customizable
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
- [X] 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?
- [ ] Bugfix
- [X] 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?
Right now the swagger json and yam are deployed in ${finalPath}-json and ${finalPath}-yaml, without possibility of customization:
http://localhost:3000/api-json
http://localhost:3000/api-yaml
Issue Number: #1968
What is the new behavior?
Added the options jsonDocumentUrl and yamlDocumentUrl in the interface SwaggerCustomOptions
If the option value is present, json and/or yaml documents are served in the specified url.
Furthermore, if globalPrefix is specified in the nest options, it's used as prefix for the custom urls.
Does this PR introduce a breaking change?
- [ ] Yes
- [X] No