Aspnetcore.docs: `[ProducesDefaultResponseType]` is never explained.

Created on 20 Dec 2018  Â·  5Comments  Â·  Source: dotnet/AspNetCore.Docs

What is [ProducesDefaultResponseType]? What status will it generate in the OpenAPI? What will it look like in Swagger?

Quick google shows that it will show a 0 and no description. That doesn't make sense to me.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P1 Source - Docs.ms

Most helpful comment

I have also tried to figure this out but there is no details about this attribute

All 5 comments

I have also tried to figure this out but there is no details about this attribute

I think it is for describing what the content will be for any responses that aren't specified by other ProducesResponseType attributes. See the section "Default Response" in the Swagger docs: https://swagger.io/docs/specification/describing-responses/

@scottaddie please respond. Perhaps point to source code?

@DotNetSparky is correct - it's meant for Default Responses - https://swagger.io/docs/specification/describing-responses/#default

I would create a new convention for authentication that applies to all actions. Example - I would like to apply attribute [SwaggerResponse((int)HttpStatusCode.Unauthorized)] OR [ProducesResponseType((int)HttpStatusCode.Unauthorized)] for all actions. Is that possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

royshouvik picture royshouvik  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

sonichanxiao picture sonichanxiao  Â·  3Comments

Mattacks picture Mattacks  Â·  3Comments