Since the newest version of the Swagger this code (because of GeneratorSettings) is now obsolete:
``` C#
app.UseSwaggerUi(typeof(Startup).GetTypeInfo().Assembly, settings =>
{
settings.GeneratorSettings.DefaultPropertyNameHandling =
PropertyNameHandling.CamelCase;
});
Instead, we should use:
``` C#
services.AddSwaggerDocument(cfg =>
{
...
});
However, I have no idea where to set-up the camel case thing now. Can anyone help me with this?
DefaultPropertyNameHandling is deprecated because you should just change the json serializer so that the spec AND serializer work the same:
Will update the wiki soon with:
public class Startup
{
...
public void ConfigureServices(IServiceCollection services)
{
// SetCompatibilityVersion is only needed for the UseSwagger() methods on ASP.NET Core >= 2.1
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddJsonOptions(options =>
{
// Use camel case properties in the serializer and the spec
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// Use string enums in the serializer and the spec
options.SerializerSettings.Converters.Add(new StringEnumConverter());
});
// Add OpenAPI/Swagger document
services.AddOpenApiDocument(); // registers a OpenAPI v3.0 document with the name "v1" (default)
// services.AddSwaggerDocument(); // registers a Swagger v2.0 document with the name "v1" (default)
}
public void Configure(IApplicationBuilder app)
{
app.UseMvc();
// Add OpenAPI/Swagger middlewares
app.UseSwagger(); // Serves the registered OpenAPI/Swagger documents by default on `/swagger/{documentName}/swagger.json`
app.UseSwaggerUi3(); // Serves the Swagger UI 3 web ui to view the OpenAPI/Swagger documents by default on `/swagger`
Using your code:
Sending request, and receiving JSON response look to me like properties are always lower cased. However, when opening Swagger UI in browser, looks like the property names are actually upper cased.

Not sure if this is just UI bug, or the code is not working as intended, here's part of JSON code:
{
"type": "integer",
"name": "Size",
"in": "query",
"format": "int32",
"maximum": 100.0,
"minimum": 1.0,
"x-nullable": false
}
Query params do not use the json serializer but can be renamed with the FromQuery(.. attribute
Alright, thanks a lot!
A question - what if we are not using Mvc ? For example, I am using NSwag in Azure Functions.
You should be able to change the contract resolver via the generator settings