How to create openapi parameter for azure function in pascal case?

2022-11-12T22:37:52.17+00:00

I am creating an azure function with open api support that receives a query parameter, this parameter should only allow a list of values, so I am using an enum as is showing in the following code:

[FunctionName("GetInformation")]  
[OpenApiOperation(operationId: "GetInformation", tags: new[] { "Information" })]  
[OpenApiParameter(name: "System", In = ParameterLocation.Query, Required = true, Type = typeof(SystemEnum), Description = "System that generates information")]  
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = "api/information")] HttpRequest req, ILogger log)  
{  
  
}  

To use the enum as string I am using the following enum

[Newtonsoft.Json.JsonConverter(typeOf(StringEnumConverter))]  
public enum SystemEnum  
{  
    SystemA,  
    SystemB,  
    SystemC  
}  

But when the azure function is launched, the system parameter appears with camelCase naming:
259796-image.png

Also in the swagger.json specification appears with camelcase naming:
259843-image.png

How can I change this behavior? Or What Do I need to change to the code to change the enum to pascalcase?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,908 questions
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-11-12T22:55:33.697+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.