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

Juan Pinzón 1 Reputation point
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.
4,116 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,097 questions
0 comments No comments
{count} votes

1 answer

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