Swashbuckle not showing comment text for property using custom type

Viewed 81

I have the following code where the important part are the properties on the Order class.

[ApiController]
[Route("[controller]")]
public class OrdersController : Controller
{
    /// <summary>
    /// Get all orders
    /// </summary>
    [HttpGet]
    public async Task<ActionResult<IEnumerable<Order>>> GetOrders()
    {
        return null;
    }
}

/// <summary>
/// The description of the order class
/// </summary>
public class Order
{
    /// <summary>
    /// The id of the order, set on the order class
    /// </summary>
    public int Id { get; set; }
    /// <summary>
    /// An order line, set on the order class
    /// </summary>
    public OrderLine OneOrderLine { get; set; }
    /// <summary>
    /// The order lines, set on the order class
    /// </summary>
    public IEnumerable<OrderLine> OrderLines { get; set; }
}

/// <summary>
/// The description of the OrderLine class
/// </summary>
public class OrderLine
{
    /// <summary>
    /// The id of the order line, set on the orderline class
    /// </summary>
    public int Id { get; set; }
}

When checking swagger ui (or swagger.json) all properties pointing to built-in types show the comments from the property but properties pointing to custom types do not.

enter image description here

As can be seen from the picture above, properties pointing to int or IEnumerable show the comment put on the property, but when the property points to the custom type directly the comment is not shown.

public OrderLine OneOrderLine { get; set; }
/// <summary>
/// The order lines, set on the order class
/// </summary>
public IEnumerable<OrderLine> OrderLines { get; set; }

How can I shown property comments pointing to custom types?

0 Answers
Related