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

feat(): enable defining global responses #933

Closed
wants to merge 1 commit into from

Conversation

razvanz
Copy link

@razvanz razvanz commented Aug 26, 2020

Enables defining global responses which are inherited by all server routes.

fixes #884

PR Checklist

Please check if your PR fulfils the following requirements:

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 behaviour?

Issue Number: #884

What is the new behaviour?

DocumentBuilder.addResponse has been added as a way to specify API responses globally. All server routes are then by default extending global responses.

SwaggerModule.createDocument(
  app,
  new DocumentBuilder()
    .addResponse({
      status: 500,
      description: 'Internal server error'
    }) // Same type as @ApiResponse decorator: ApiResponseOptions
   ...
)

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@woodcockjosh
Copy link

@razvanz can you fix the merge conflicts. Would love to have this.

Enables defining global responses which are inherited by all server
routes.

fixes nestjs#884
@razvanz razvanz force-pushed the feat/define-global-responses branch from 8a44bcd to 223c53c Compare November 24, 2020 10:46
@cooperate
Copy link

Any updates on this? Has this been resolved already?

@cooperate
Copy link

I made my own PR with the merge conflicts resolved FWIW.
#1287

@kamilmysliwiec
Copy link
Member

Closing as this PR seems to be stale

@woodcockjosh
Copy link

Please reopen this. I would really like to have this feature. It only got stale because no one ever merged it.

@kamilmysliwiec
Copy link
Member

If you're interested in creating a PR that uses this PR + resolves conflicts, that would be great! Contributions are more than welcome

@nestjs nestjs locked and limited conversation to collaborators Jul 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: define api response description globally
4 participants