RicoSuter/NSwag
GitHub で見るHow to disable generating parameters for headers using SwaggerToCSharpWebApiControllerGenerator
Open
#642 opened on 2017年3月1日
help wantedproject: NSwag.CodeGeneration.CSharp (Clients)type: bug
説明
Swagger document:
{
"swagger": "2.0",
"paths": {
"/authorization": {
"put": {
"operationId": "Test",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"type": "string"
}
],
"responses": {
"204": {
"description": ""
}
}
}
}
}
}
Generated code:
namespace MyNamespace
{
#pragma warning disable // Disable all warnings
[System.CodeDom.Compiler.GeneratedCode("NSwag", "9.6.6264.38294")]
public interface IController
{
System.Threading.Tasks.Task TestAsync(string authorization);
}
[System.CodeDom.Compiler.GeneratedCode("NSwag", "9.6.6264.38294")]
public partial class Controller : System.Web.Http.ApiController
{
private IController _implementation;
public Controller(IController implementation)
{
_implementation = implementation;
}
[System.Web.Http.HttpPut, System.Web.Http.Route("authorization")]
public System.Threading.Tasks.Task Test(string authorization)
{
return _implementation.TestAsync(authorization);
}
}
}