Skip to content

issue on openapi generator #68

@walid1001

Description

@walid1001

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);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions