Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue on openapi generator #68

Open
walid1001 opened this issue Feb 3, 2021 · 1 comment
Open

issue on openapi generator #68

walid1001 opened this issue Feb 3, 2021 · 1 comment

Comments

@walid1001
Copy link

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);
  }
}
@Plinzen
Copy link

Plinzen commented Mar 18, 2021

Hello,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants