Jaguar-dart / client

Contains various packages for client side

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issue on openapi generator

walid1001 opened this issue · comments

Hi
after build_runner run
the generated class in output.

The method returning class is not typecasted.

am I do it wrong ?

thank you for your help.

@GenApiClient()
class IdentityApi extends ApiClient with _$IdentityApiClient {
    final Route base;
    final Map<String, CodecRepo> converters;
    final Duration timeout;

    IdentityApi({this.base, this.converters, this.timeout = const Duration(minutes: 2)});

    /// 
    ///
    /// 
    @PostReq(path: "/login")
    Future<InlineResponse200> userMgmGetToken(
            
            @AsFormField() String grantType, 
            
            @AsFormField() String password, 
            
            @AsFormField() String username
        ) {
        return super.userMgmGetToken(

        
        grantType, 
        
        password, 
        
        username
        ).timeout(timeout);
    }

    /// 
    ///
    /// 
    @GetReq(path: "/logout", metadata: {"auth": [ {"type": "oauth2", "name": "OauthAuth" }]})
    Future<InlineResponse2001> userMgmRevokeToken(
        ) {
        return super.userMgmRevokeToken(

        ).timeout(timeout);
    }

    /// 
    ///
    /// 
    @GetReq(path: "/test", metadata: {"auth": [ {"type": "oauth2", "name": "OauthAuth" }]})
    Future<InlineResponse2001> userMgmTest(
        ) {
        return super.userMgmTest(

        ).timeout(timeout);
    }
}

And the one generated by jaguar code gen

// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'identity_api.dart';

// **************************************************************************
// JaguarHttpGenerator
// **************************************************************************

abstract class _$IdentityApiClient implements ApiClient {
  final String basePath = "";
  dynamic userMgmGetToken(
      String grantType, String password, String username) async {
    var req = base.post
        .path(basePath)
        .path("/login")
        .urlEncodedFormField("grantType", grantType)
        .urlEncodedFormField("password", password)
        .urlEncodedFormField("username", username);
    return await req.go(throwOnErr: true);
  }

  dynamic userMgmRevokeToken() async {
    var req = base.get
        .metadata({
          "auth": [
            {
              "type": "oauth2",
              "name": "OauthAuth",
            }
          ],
        })
        .path(basePath)
        .path("/logout");
    return await req.go(throwOnErr: true);
  }

  dynamic userMgmTest() async {
    var req = base.get
        .metadata({
          "auth": [
            {
              "type": "oauth2",
              "name": "OauthAuth",
            }
          ],
        })
        .path(basePath)
        .path("/test");
    return await req.go(throwOnErr: true);
  }
}

Hello,

we have the same issue when using openapi generator. Did you find a solution?