Base solution for your next web application
Open Closed

Input containing a dto is split by swagger #6125


User avatar
0
daws created

I'm designing app service methods in my backend and I call them in angular through the generated service.proxies.

public class MyAppService : ApplicationService, IMyAppService
{
    public MyMethod(MyInput input){
      ...
    }
}
public class MyInput {
    DateTime start;
    DateTime end;
    MyDto dto;
}
public class MyDto {
    property1 {get; set;}
    ...
    property20 {get; set;}
}

My issue is that, in the frontend, the dto class is split into each of its fields when generating the proxy with swagger :

myServiceproxy{
    myMethod( DateTime start, DateTime end, property1, ..., property20 ) {
        ...
    }
}

Can I generate it so that it doesn't split my DTO object ? Like this :

myServiceproxy{
    myMethod( DateTime start, DateTime end, MyDto dto ) {
       ...
    }
}

(To be more specific, one of the properties of MyDto is also a Dto. But both DTO classes are used extensively as is in the frontend)

I'm using ASP.NET zero 5.2, ASP.NET Core + Angular


1 Answer(s)