Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Feat: Support header-based versioning and filtering routes by version #3209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aarongoin
Copy link

@aarongoin aarongoin commented Dec 12, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables) (formatting changes from running npm run format)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Currently @nestjs/wagger does not support header-based versioning that is documented as being supported here: https://docs.nestjs.com/techniques/versioning#header-versioning-type

In addition end users lack any ability to filter the routes documented in the OpenAPI specification down to some subset of versions their app supports.

Issue Number: #2990

What is the new behavior?

Apps that use header-based versioning for endpoints (and I believe media-type based versioning as well though I haven't tested) are now properly supported. Endpoints of different versions using the same path no longer conflict with each other and are documented as separate endpoints in the resulting OpenAPI specification.

Additionally users can filter the endpoints documented down to a subset to better support use cases where there is a separate swagger document per API version.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…Options interface

Add optional property `includeVersions` to the SwaggerDocumentOptions interface so users can filter the generated OpenAPI specification and resulting Swagger UI down to routes matching a specific version or subset of versions rather than including all versions as is the default behavior.
@aarongoin aarongoin changed the title Support header-based versioning and filtering routes by version Fix/Feat: Support header-based versioning and filtering routes by version Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants