'Swagger Summary for Enum not showing
I am using xml annotations on my API endpoints which contain information about the endpoint responses as well as a summary for that endpoint.
On my request model, each property has a describing the property. This all works fine except for when I try to add a summary to an Enum.
For example, I have the following property in my class:
/// <summary>
/// Domain Model Class
/// </summary>
public DomainModelClass? AssetDomainModelClass { get; set; }
And DomainModelClass is an Enum
When I go to the swagger page, there is no description on AssetDomainModelClass
Additionally I looked at the json that is created, and it does not contain a description for the Enum field
But the summary works for all non Enum properties, such as the AssetId one right above my example. How can I get a summary to attach to Enum values?
I am using Swashbuckle.AspNetCore (6.0.7)
Solution 1:[1]
I hope you found this when you needed it, but for people like me:
services.AddSwaggerGen(options =>
{
options.UseInlineDefinitionsForEnums();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Maria Kioko |


