RicoSuter/NSwag

use of AcceptVerbsAttribute crashes json generation [aspnetcore]

Open

#1 203 ouverte le 22 févr. 2018

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C# (1 189 forks)batch import
help wantedtype: bug

Métriques du dépôt

Stars
 (6 291 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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()

Guide contributeur