Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Suppress default status code response type in api descriptions when e… #4831

Closed
wants to merge 1 commit into from

Conversation

kichalla
Copy link
Member

@kichalla kichalla commented Jun 8, 2016

…xplicit response types have been provided

[Fixes #4823] How to override the default (200) status code with ProducesResponseType

@rynowak

@@ -382,6 +375,15 @@ private string GetRelativePath(RouteTemplate parsedTemplate)
}
}

// Set the default status only when no status has already been set explicitly
if (objectTypes.Count == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you merge the two ifs?

@pranavkm
Copy link
Contributor

pranavkm commented Jun 8, 2016

:shipit: when @rynowak is happy.

{
objectTypes[StatusCodes.Status200OK] = type;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this all seems contingent on the objectTypes what will happen by default if the method returns void

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if an action returns void, then it would by default not have any apidescriptions...metadata needs to be explicitly decorated ex: https://github.com/aspnet/Mvc/blob/dev/test/WebSites/ApiExplorerWebSite/Controllers/ApiExplorerResponseTypeWithoutAttributeController.cs#L14

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open a bug for this? I don't want to bloat this PR, but it seems wrong that we infer 'default 200' when you a DTO as your return type and 'nothing' when you have void as your return type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure: #4838

@rynowak
Copy link
Member

rynowak commented Jun 9, 2016

:shipit:

…xplicit response types have been provided

[Fixes #4823] How to override the default (200) status code with ProducesResponseType
@kichalla kichalla force-pushed the kiran/fix-statuscode branch from 3c16860 to 964d5dc Compare June 9, 2016 19:06
@kichalla
Copy link
Member Author

kichalla commented Jun 9, 2016

f1982bd

@kichalla kichalla closed this Jun 9, 2016
@kichalla kichalla deleted the kiran/fix-statuscode branch August 4, 2016 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants