Search code examples
swaggerodataasp.net-core-webapiswagger-ui.net-5

How to change OData API paths to lowercase format?


I added OData to my .NET Web API. I only use it for querying data (HttpMethod GET).

When I run my application, and I look at Swagger I see the following:

enter image description here

As you can see, the OData endpoints use uppercase name for the resource set which I something I really dislike. It's important to note that the endpoints work fine even in lowercase.

How can I make it so that the OData endpoints use lowercase by default to create consistency in my swagger documentation?

Thanks in advance


Solution

  • Use:

    services.AddRouting(options => options.LowercaseUrls = true);
    

    In your startup.cs