A. Hasemeyer
A. Hasemeyer

Reputation: 1734

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

enter image description here

Additionally I looked at the json that is created, and it does not contain a description for the Enum field

enter image description here

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)

Upvotes: 0

Views: 1750

Answers (1)

Maria Kioko
Maria Kioko

Reputation: 41

I hope you found this when you needed it, but for people like me:

services.AddSwaggerGen(options =>
{
    options.UseInlineDefinitionsForEnums();
}

Upvotes: 4

Related Questions