zijianhuang / webapiclientgen

Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
MIT License
167 stars 38 forks source link

Multiple response codes and types #59

Closed hmvs closed 3 years ago

hmvs commented 5 years ago

Right now our API looks like that:

 [HttpGet("some-method")]
[ProducesResponseType(typeof(SomeOurResponse), 200)]
[ProducesResponseType(typeof(ExceptionModel), 400)]
[ProducesResponseType(typeof(ExceptionModel), 404)]

public async Task<ObjectResult<SomeOurResponse>> GetSomethingAsync(int accountId, int id) {
    var response = await this._service.SomeOurMethod(accountId, id);
    return this.Ok<SomeOurResponse>(response);
}   

WebclientGenerator will generate method like this:

   public async Task<AudienceProject.AudienceHub.Models.ExceptionModel> GetPossibleReachAsync(int accountId, int id)
        {
zijianhuang commented 3 years ago

not so feasible with generated codes.