This is the definition added in clean1.csproj file based on NSwag's documentation
<Target Name="AfterBuild">
<Exec Command="$(NSwagExe) webapi2swagger /assembly:$(OutDir)/Clean1.dll /referencepath: $(ProjectDir) /output:$(ProjectDir)/clean1swagger.json" />
The problem is that only 200 response code is being generated like:
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/Product"
},
"x-nullable": true
}
}
Here are the XML comments at the controller's demo call.
/// <summary>
/// Gets a product by Id
/// </summary>
/// <remarks>
/// Remarks-description text.
/// </remarks>
/// <response code="200">test 200</response>
/// <response code="201">test 201/response>
/// <response code="400">test 400</response></response>
[HttpGet]
[ResponseType(typeof(Product))]
public IHttpActionResult GetProduct(int id)
{
var product = products.FirstOrDefault((p) => p.Id == id);
if (product == null)
{
return NotFound();
}
return Ok(product);
}
The json should include and generate automatically the other responses.