You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
When using IHostApplicationBuilder, I cannot figure out how to adjust the Json Serialization setting to match what the function returns.
To Reproduce
Steps to reproduce the behavior:
Create a default HttpTrigger function app, which should use FunctionsApplication.CreateBuilder(args)
Change the Json Options to use a different naming policy
Update the HttpTrigger to return an object and add an appropriate [OpenApiResponseWithBody] attribute.
View the Swagger UI page, the respons object will not have appropriate formatting of names, while when you run the HtttpTrigger will return proper casing.
namespaceCompany.Function{publicclassHttpTrigger1{privatereadonlyILogger<HttpTrigger1>_logger;publicHttpTrigger1(ILogger<HttpTrigger1>logger){_logger=logger;}[Function("HttpTrigger1")][OpenApiOperation(operationId:"Run")][OpenApiResponseWithBody(HttpStatusCode.OK,"application/json",typeof(ResponseData),Description="Some Data")]publicIActionResultRun([HttpTrigger(AuthorizationLevel.Function,"get","post")]HttpRequestreq){_logger.LogInformation("C# HTTP trigger function processed a request.");returnnewOkObjectResult(newResponseData{AgeInYears=18,FullName="Fred"});}}publicclassResponseData{publicintAgeInYears{get;set;}publicstringFullName{get;set;}=string.Empty;}}
Current behavior:
You can see in the screen shot that the execution response used the proper casing (SnakeCaseLower), but the Example Value Response did not.
Expected behavior
It would be ideal for the same serializer to be used in both the response objects and the Swagger UI/OpenAPI schema.
The text was updated successfully, but these errors were encountered:
rhullah
changed the title
Bug report, feature request or other request
Cannot set Json Serialization settings for Swagger UI/ OpenAPI schema when using IHostApplicationBuilder
Nov 27, 2024
Describe the issue
When using IHostApplicationBuilder, I cannot figure out how to adjust the Json Serialization setting to match what the function returns.
To Reproduce
Steps to reproduce the behavior:
FunctionsApplication.CreateBuilder(args)
[OpenApiResponseWithBody]
attribute.Program.cs
HttpTrigger1.cs
Current behavior:
You can see in the screen shot that the execution response used the proper casing (SnakeCaseLower), but the Example Value Response did not.
Expected behavior
It would be ideal for the same serializer to be used in both the response objects and the Swagger UI/OpenAPI schema.
The text was updated successfully, but these errors were encountered: