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

[BUG] Generates non-working code on versions 2.2.3+ #297

Closed
point-source opened this issue Jan 6, 2022 · 3 comments
Closed

[BUG] Generates non-working code on versions 2.2.3+ #297

point-source opened this issue Jan 6, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@point-source
Copy link

Describe the bug
Starting in 2.2.3, some overrides are failing due to a type mismatch.

To Reproduce
Here is the swagger code: https://github.com/point-source/dart_plaid/blob/main/swagger/plaid_service.swagger
Error:

00:00 +0 -1: loading test/dart_plaid_test.dart [E]                                                                                                                                                                                                          
  Failed to load "test/dart_plaid_test.dart":
  lib/generated/plaid_service.swagger.dart:11776:43: Error: The return type of the method 'Transaction.transactionType' is 'TransactionTransactionType?', which does not match the return type, 'TransactionBaseTransactionType?', of the overridden method, 'TransactionBase.transactionType'.
   - 'TransactionTransactionType' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
   - 'TransactionBaseTransactionType' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
  Change to a subtype of 'TransactionBaseTransactionType?'.
    final enums.TransactionTransactionType? transactionType;
                                            ^
  lib/generated/plaid_service.swagger.dart:11560:47: Context: This is the overridden method ('transactionType').
    final enums.TransactionBaseTransactionType? transactionType;
                                                ^
  lib/generated/plaid_service.swagger.dart:24208:50: Error: The return type of the method 'AccountIdentity.verificationStatus' is 'AccountIdentityVerificationStatus?', which does not match the return type, 'AccountBaseVerificationStatus?', of the overridden method, 'AccountBase.verificationStatus'.
   - 'AccountIdentityVerificationStatus' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
   - 'AccountBaseVerificationStatus' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
  Change to a subtype of 'AccountBaseVerificationStatus?'.
    final enums.AccountIdentityVerificationStatus? verificationStatus;
                                                   ^
  lib/generated/plaid_service.swagger.dart:10958:46: Context: This is the overridden method ('verificationStatus').
    final enums.AccountBaseVerificationStatus? verificationStatus;
                                               ^
  lib/generated/plaid_service.swagger.dart:24330:48: Error: The return type of the method 'AccountAssets.verificationStatus' is 'AccountAssetsVerificationStatus?', which does not match the return type, 'AccountBaseVerificationStatus?', of the overridden method, 'AccountBase.verificationStatus'.
   - 'AccountAssetsVerificationStatus' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
   - 'AccountBaseVerificationStatus' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
  Change to a subtype of 'AccountBaseVerificationStatus?'.
    final enums.AccountAssetsVerificationStatus? verificationStatus;
                                                 ^
  lib/generated/plaid_service.swagger.dart:10958:46: Context: This is the overridden method ('verificationStatus').
    final enums.AccountBaseVerificationStatus? verificationStatus;
                                               ^
  lib/generated/plaid_service.swagger.dart:28946:54: Error: The return type of the method 'AssetReportTransaction.transactionType' is 'AssetReportTransactionTransactionType?', which does not match the return type, 'TransactionBaseTransactionType?', of the overridden method, 'TransactionBase.transactionType'.
   - 'AssetReportTransactionTransactionType' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
   - 'TransactionBaseTransactionType' is from 'package:dart_plaid/generated/plaid_service.enums.swagger.dart' ('lib/generated/plaid_service.enums.swagger.dart').
  Change to a subtype of 'TransactionBaseTransactionType?'.
    final enums.AssetReportTransactionTransactionType? transactionType;
                                                       ^
  lib/generated/plaid_service.swagger.dart:11560:47: Context: This is the overridden method ('transactionType').
    final enums.TransactionBaseTransactionType? transactionType;
                                                ^

Library version used:
2.2.3 up to 2.3.2

Additional context
Feel free to clone this repo, update the swagger library dependency, and regenerate to reproduce.

@fryette
Copy link
Contributor

fryette commented Jan 6, 2022

Yes, seems problem with the prefix enum.
For now, seems we should be able to drop it completely.(enum.)

New version will be released on Monday

@Vovanella95
Copy link
Collaborator

Hi @point-source
I was on VAC, will fix this issue soon.

@Vovanella95
Copy link
Collaborator

@point-source Fixed in latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants