OpenAPI model incorrect for classes derived from generic List


I am using ServiceStack 5.1.0 with Visual Studio 2017, .NET Framework 4.7.1.
I tested the OpenAPI plugin to get some Metadata, with which we can build REST clients for other programming languages.

I think I found a bug in this plugin. Unfortunately, I cannot upload a demo project, so I try to show the relevant code here.
In some cases, I am using classes in the response, which are derived from a generic List. In this cases, the OpenAPI plugin produces wrong output.

Type A:

public class TypeA
    public int MyPropertyA { get; set; }

public class ResponseA
    public List<TypeA> ListA { get; set; }

[Route("/typeA", "GET")]
public class GetTypeA : IGet, IReturn<ResponseA>


Type B:

public class TypeB
    public int MyPropertyB { get; set; }

public class TypeBList : List<TypeB>
    // Some other helper functions, e.g. Get max MyPropertyB of all items

public class ResponseB
    public TypeBList ListB { get; set; }

[Route("/typeB", "GET")]
public class GetTypeB : IGet, IReturn<ResponseB>



public class MyServices : Service
    public object Get(GetTypeA request)
        var result = new ResponseA();
        result.ListA = new List<TypeA>();
        result.ListA.Add(new TypeA() { MyPropertyA = 1 });
        result.ListA.Add(new TypeA() { MyPropertyA = 2 });

        return result;

    public object Get(GetTypeB request)
        var result = new ResponseB();
        result.ListB = new TypeBList();
        result.ListB.Add(new TypeB() { MyPropertyB = 1 });
        result.ListB.Add(new TypeB() { MyPropertyB = 2 });

        return result;


When running the example and calling
produces the same JSON output - as expected:



But when I look at the OpenAPI output at
it produces different models for TypeA and TypeB. In TypeB, it shows some properties “Capacity”, “Count” and “Item”, which are members of the List class.
On the other hand, I cannot see, that TypeB contains any kind of List or Array of elements.

So I think the model of TypeB is incorrect, as it does not match to the generated JSON.

By the way: The same happens, when I use the Swagger plugin instead of OpenAPI.

Best regards,

You can’t inherit a List<T> for Response DTOs, they can either be an IEnumerable (e.g. List<T>) or a POCO class, it can’t be both.

You mean, that the classes in the response should not have any “own intelligence”, so my class “TypeBList” should be unnecessary?

I was just confused, because the JSON result looks correct.
So I must use the TypeA?

Right DTOs shouldn’t have any logic in them, and you should use List<T> or TypeA in this case.