Describe the bug
In the Swagger documentation, descriptions of properties derived from classes always show the information from the <summary> of the class, not the <summary> of the property. For example, here is the definition of the slightly altered WeatherForecast demo project's WeatherForecast class:
/// <summary>
/// Weather forecast info.
/// </summary>
public class WeatherForecast
{
/// <summary>
/// City name.
/// </summary>
public string? City { get; set; }
/// <summary>
/// Forecast date.
/// </summary>
public DateOnly Date { get; set; }
/// <summary>
/// Forecast summary.
/// </summary>
public string? Summary { get; set; }
/// <summary>
/// Forecasted temperature in the specified city.
/// </summary>
public Temperature? Temperature { get; set; }
}
The Temperature property is a complex type defined as:
/// <summary>
/// Holds temperature in Celsius and Fahrenheit.
/// </summary>
public class Temperature
{
/// <summary>
/// Temperature in C.
/// </summary>
public int TemperatureC { get; set; }
/// <summary>
/// Temperature in F.
/// </summary>
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
Notice that the summary of the Temperature property in the WeatherForecast class (Forecasted temperature in the specified city.) is different from the summary of the Temperature class definition (Holds temperature in Celsius and Fahrenheit.), but when displayed in the Swagger documentation, the summary of the property is discarded, so only the class summary is displayed:

The problem is that the class summary is not specific enough to describe a property derived from this class. It may not be obvious in this example, but say, I have a meta class that defines the details of a patch operation for patching objects and I want to specify which patch operations are supported for each class. This can be only be done in the summary of the property, not in the class summary (because the class does not know where and how it will be used), right? But there seems to be no way to do it.
Attached is the sample project.
Expected behavior
Swagger description of a schema's (class) property must always contain the summary of this property as defined in the containing schema (class), not the summary of the class (schema) that this property is derived from.
Actual behavior
Swagger description of a schema's (class) property always shows the summary of the class (schema) that this property is derived from, not the property's summary.
Steps to reproduce
Use the attached project.
TestSwagger.zip
Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
7.2.0
.NET Version
9.0.102
Anything else?
No response
Describe the bug
In the Swagger documentation, descriptions of properties derived from classes always show the information from the
<summary>of the class, not the<summary>of the property. For example, here is the definition of the slightly altered WeatherForecast demo project'sWeatherForecastclass:The
Temperatureproperty is a complex type defined as:Notice that the summary of the
Temperatureproperty in theWeatherForecastclass (Forecasted temperature in the specified city.) is different from the summary of theTemperatureclass definition (Holds temperature in Celsius and Fahrenheit.), but when displayed in the Swagger documentation, the summary of the property is discarded, so only the class summary is displayed:The problem is that the class summary is not specific enough to describe a property derived from this class. It may not be obvious in this example, but say, I have a
metaclass that defines the details of apatchoperation for patching objects and I want to specify which patch operations are supported for each class. This can be only be done in the summary of the property, not in the class summary (because the class does not know where and how it will be used), right? But there seems to be no way to do it.Attached is the sample project.
Expected behavior
Swagger description of a schema's (class) property must always contain the summary of this property as defined in the containing schema (class), not the summary of the class (schema) that this property is derived from.
Actual behavior
Swagger description of a schema's (class) property always shows the summary of the class (schema) that this property is derived from, not the property's summary.
Steps to reproduce
Use the attached project.
TestSwagger.zip
Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
7.2.0
.NET Version
9.0.102
Anything else?
No response