epam-cross-platform-lab / swagger-dart-code-generator

Swagger/OpenAPI code generator based on Chopper and JsonAnnotation for Flutter
Apache License 2.0
254 stars 112 forks source link

[BUG] Generated files fails because of major change in Chopper v8.0.0 #749

Closed RoarGronmo closed 22 hours ago

RoarGronmo commented 2 months ago

Describe the bug Generated code is failing on interceptors because of breaking changes in chopper v8.0.0

To Reproduce

Expected behavior Flawless code generation

Swagger specification link Links to breaking change in chopper: https://pub.dev/packages/chopper/changelog https://github.com/lejard-h/chopper/pull/547

Library version used: swagger_dart_code_generator: ^2.15.2

Additional context Seems still valid if chopper v.7.4.x is used

diegotori commented 2 months ago

@Vovanella95 gentle reminder that this will block folks like us that want to use the latest version of Chopper while using this library. Thanks in advance.

praneethk666 commented 2 months ago

error: the argument type iterable dynamic' can't be assigned to the parameter type list interceptor in swagger_json.swagger.dart.

RoarGronmo commented 2 months ago

@fryette Can you take a look at this issue ?

diegotori commented 2 months ago

@Vovanella95 looks like you're currently active today according to your Github activity. Just another gentle reminder regarding this issue. Thanks.

af-chacon commented 2 months ago

The line in question is the following: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/blob/9533c64536a018f5da9217ea838fbc43a5e83a8b/lib/src/code_generators/swagger_requests_generator.dart#L121

Iterable<dynamic>?

Needs to be changed to

List<Interceptor>?

I have a local build with this change that fixes it. lmk if I can provide any more help.

af-chacon commented 2 months ago

@diegotori you can change your autogenerated code for now to use List<Interceptor>? interceptors instead of Iterable<dynamic>? interceptors at the class defenition that extends ChopperService in you name.swagger.dart file.

That should get you unblocked.

af-chacon commented 2 months ago

@fryette @Vovanella95 Can either of you take a look at the PR?

RoarGronmo commented 2 months ago

Are @fryette and @Vovanella95 still alive ?

diegotori commented 2 months ago

Are @fryette and @Vovanella95 still alive ?

Based on @Vovanella95's activity, looks like he is, since he's been opening PRs in another project.

Perhaps he's getting slammed with other pressing matters.

@Vovanella95 ball is in your court.

RoarGronmo commented 2 months ago

@af-chacon Do you have a "setup" on how we can use your fork with your fix PR of this repository (I am not to familiar with how .yaml works) in our projects, until @fryette or @Vovanella95 wakes up ?

RoarGronmo commented 1 month ago

@af-chacon Do you have a "setup" on how we can use your fork with your fix PR of this repository (I am not to familiar with how .yaml works) in our projects, until @fryette or @Vovanella95 wakes up ?

Found a solution for this one: In pubspec.yaml:

Replace current dependency: swagger_dart_code_generator: ^2.15.2 with:

  swagger_dart_code_generator:
    git:
      url: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator.git
      ref: bacb7781f94e44cb217f163aee8cb681b40d55af
  1. Run flutter pub upgrade --major-versions
  2. Run flutter pub get (just for the case of it)
  3. Run dart run build_runner build --delete-conflicting-outputs
  4. Build your flutter program...

I hope @fryette and @Vovanella95 is still alive, but I fear this dependency to die soon if no one maintains it anymore, it has lowered its score to 120 now... ...I may look for a replacement if we don't hear from them in 2-3 months.

MartinAKovachev commented 1 month ago

We need a fix asap (update to the latest chopper version). It's a real struggle to update tens of swagger files because this issue.

RoarGronmo commented 1 month ago

We need a fix asap (update to the latest chopper version). It's a real struggle to update tens of swagger files because this issue.

Have you tried the intermediate solution above, until @Vovanella95 or @fryette responds ?

juliansteenbakker commented 1 month ago

You can use the following until a new version is released.

  swagger_dart_code_generator:
    git:
      url: https://github.com/af-chacon/swagger-dart-code-generator
      ref: user/aedis/fix-chopper-8-iterceptor-generation
Rodsevich commented 5 days ago

Any updates on this, guys? @Vovanella95 @fryette ? Is there a chance you give merge/publish permissions for anyone else?

Vovanella95 commented 22 hours ago

Should be fine in next release