How to change JSON schema generated by Swagger?

Viewed 30

By default, in ASP.NET Web API apps swagger generates JSON-schema in which class field names start with a lowercase letter. For example, for this class:

    public class WeatherForecast
    {
        public DateTime Date { get; set; }
    
        public int TemperatureC { get; set; }
    
        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
    
        public string? Summary { get; set; }
    }

the following schema will be generated: schema

How to configure it so that the field names in schema exactly match the names in the C# code?

I read this document from Microsoft (ASP.NET Core web API documentation with Swagger / OpenAPI), but did not find the answer

0 Answers
Related