unchase / Unchase.Swashbuckle.AspNetCore.Extensions

:hammer: A library contains a bunch of extensions (filters) for Swashbuckle.AspNetCore.
https://www.nuget.org/packages/Unchase.Swashbuckle.AspNetCore.Extensions
Apache License 2.0
115 stars 16 forks source link

add "x-enumNames" for schema properties no matter if the type is gene… #5

Closed ZeVS777 closed 4 years ago

ZeVS777 commented 4 years ago

If the class is generic you must give description not only for generic arguments, but also for its own properties. For example:

/// <summary>
///     API response status
/// </summary>
public enum Status
{
    /// <summary>
    ///     Normal response
    /// </summary>
    Ok,
    /// <summary>
    ///     Some fail
    /// </summary>
    Fail
}

public class ApiResponse<T>
{
    /// <summary>
    ///     API response status
    /// </summary>
    public Status Status { get; set; }

    /// <summary>
    ///     Response data
    /// </summary>
    public T Data { get; set; }
}

//Action attribute 
[ProducesResponseType(StatusCodes.Status201Created, Type = typeof(ApiResponse<SomeClass>))]

Before this pull request you will not get description for Status enum property of the ApiResponse

unchase commented 4 years ago

Agree. Thanks.