RicoSuter/NSwag
View on GitHubuse of AcceptVerbsAttribute crashes json generation [aspnetcore]
Open
#1,203 opened on Feb 22, 2018
help wantedtype: bug
Repository metrics
- Stars
- (6,291 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
I have a controller action attributed with [HttpPost(""), AcceptVerbs("CustomVerb")]. (Without the AcceptVerbsAttribute everything is fine.).
Update: Also happens with non-custom default verbs: [Route("test"), AcceptVerbs("PUT", "DELETE")]
Instead of the swagger json I only get a text/plain result:
System.InvalidCastException: The object of type "WhereSelectArrayIterator`2[System.String,System.String]" cannot be converted to type "System.Collections.ICollection".
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<GetSupportedHttpMethodsFromAttributes>d__24.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<GetSupportedHttpMethods>d__23.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<GenerateForControllerAsync>d__11.MoveNext()
---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<GenerateForControllersAsync>d__9.MoveNext()
---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.AspNetCore.Middlewares.SwaggerMiddleware.<GenerateSwaggerAsync>d__8.MoveNext()