-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Consider the below model used for an API endpoint
public class VideoEventCreateDto
/// <summary>
/// Image Type desc
/// </summary>
[Required]
public ImageType ImageFileType { get; set; }
}
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ImageType
{
Jpeg,
Png,
Bmp,
}
No description tag comes through in the swagger.json. Similar issue with other xml comments like <example>
Swashbuckle version 6.1.4
It does however work if you supply it only on the enum:
public class VideoEventCreateDto
[Required]
public ImageType ImageFileType { get; set; }
}
/// <summary>
/// Image Type desc
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ImageType
{
Jpeg,
Png,
Bmp,
}
However, I think it would be an improvement to allow it to be supplied on the property, as this is more consistent with how XML comments work on other valuetypes such as datetime. You could have different XML comments depending on the use case.
Unfortunately, to be backward compatible, you may need to implement logic to say that if the XML is supplied on the property, then it takes precedence over what is supplied on the enum. Or some similar logic
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels