OpenApiResponseWithBody containing property named `parameters` throws exception
See original GitHub issueDescribe the issue
Using a class that contains a property named parameters
in the OpenApiResponseWithBody
attribute crashes the ../swagger.json
endpoint.
Using version 1.3.0
.
To Reproduce Decorate a function with this:
[OpenApiOperation]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Output))]
The class Output
looks like this
public class Output
{
public string parameters { get; set; }
}
Returns this when calling /swagger.json
endpoint:
Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken.
at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
at Newtonsoft.Json.Linq.Extensions.Convert[T,U](IEnumerable`1 source)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.Render(OpenApiSpecVersion version, OpenApiFormat format)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.<>c__DisplayClass18_0.<RenderAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.RenderAsync(OpenApiSpecVersion version, OpenApiFormat format)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.OpenApiTriggerFunctionProvider.RenderSwaggerDocument(HttpRequest req, String extension, ExecutionContext ctx, ILogger log)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Azure Function - ServiceBusTrigger - Exception Binding ...
Exception while executing function: <functionName>. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'message'. System.Private.CoreLib: ...
Read more >How to troubleshoot Azure Function HTTP Trigger 404 Error
If the name parameter is missing, this function will return a 404 error with the message "The resource you are looking for has...
Read more >Listener for Azure function was unable to start error while ...
I have one Azure function app and I am trying to run that locally but getting the below error. I have the storage...
Read more >Describing Responses
An API can respond with various media types. JSON is the most common format for data exchange, but not the only one possible....
Read more >Azure Functions v3 migration guide from .NET Core 3.1 to ...
This guide will help you migrate from a project with Azure Functions v3 on .NET Core 3.1 to the new Azure Functions Isolated...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Got the same issue using version 1.5.0.
Downgrading to version 1.1.0 solved the issue which seems to have been introduced in 1.2.0
I have a similar issue. I’m trying to use a multipart/form-data with:
the MultiPartFormData is like:
Using [Microsoft.Azure.WebJobs.Extensions.OpenApi] version 1.1.0 and .Net6 the parameter is not shown in the swagger. Upgrading [Microsoft.Azure.WebJobs.Extensions.OpenApi] to 1.2.0 or earlier then throw the exception: