'What is the .NET equivalent of "ProducesResponseType" from Net Core?
I have to do a "backward" from an API made with NET CORE to .NET
I'm facing a problem changing [ProducesResponseType]
from Net Core in a valid equivalent of .NET
I have for example this code:
[ApiExplorerSettings(GroupName = "groupName")]
[ProducesResponseType(typeof(something), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(void), StatusCodes.Status500InternalServerError)]
[HttpPost("thing", Name = "creatingThisThing")]
public async Task<IHttpActionResult> PostThing([FromBody]dynamic value)
{
/// Other Stuff
I understand I can avoid using the group name and I can adapt the route like this:
[HttpPost]
[Route("", Name = "creatingThisThing")]
/// etc
But I'd like to know what can I use to "replace" the previously mentioned.
Hope I was clear enough.
Solution 1:[1]
I used [ResponseType(typeof(SomeClass))]
from System.Web.Http.Description
successfully with .NET 4.6.1.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tkit |