gibahjoe / openapi-generator-dart

Openapi Generator for Dart/Flutter
BSD 3-Clause "New" or "Revised" License
128 stars 34 forks source link

DART2_API generator fails for v2.0.0 #27

Closed harsimranmaan closed 3 years ago

harsimranmaan commented 3 years ago
[WARNING] openapi_generator:openapi_generator on lib/trober.dart:
Exception in thread "main" java.lang.NoSuchFieldError: isMapContainer
        at cd.connect.openapi.DartV3ApiGenerator.lambda$updateAllModels$2(DartV3ApiGenerator.java:192)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at cd.connect.openapi.DartV3ApiGenerator.lambda$updateAllModels$3(DartV3ApiGenerator.java:172)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at cd.connect.openapi.DartV3ApiGenerator.lambda$updateAllModels$4(DartV3ApiGenerator.java:162)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at cd.connect.openapi.DartV3ApiGenerator.updateAllModels(DartV3ApiGenerator.java:158)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:504)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:875)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:432)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

See: https://github.com/bigpanther/trober/pull/92/checks?check_run_id=1614823203 for full run.

DART, DART_DIO and DART_JAGUAR all work fine (at least for generation)

gibahjoe commented 3 years ago

Hi, thank you for raising an issue.

What version of the are you using? Also, can you provide a minimal spec that has same issue?

gibahjoe commented 3 years ago

Sorry, I just read your title. Your version is 2.0.0.

I think the issue is that the Dart2_api has not implemented the changes in Openapi generator v5 which had a lot of breaking changes. If this worked previously, please downgrade to an earlier version that worked (2.0.0-nullsafety.0)

harsimranmaan commented 3 years ago

Just curious, why are you using the cli jar from dart-ogurets/dart-openapi-maven instead of the default openapicli? It seems to have dart2 support too.

gibahjoe commented 3 years ago

Yes, it does have dart2 support, that is what the DART generator name is.

Openapi generator Dart2 support used to be very lacking and buggy. Thats when the dart-ogurets/dart-openapi-maven was added.

So, DART is still dart2. Its the official openapi generator while dart-ogurets/dart-openapi-maven is an addon

harsimranmaan commented 3 years ago

Makes sense. Thanks.

agilob commented 3 years ago

There is no name dart2 generator now https://github.com/gibahjoe/openapi-generator-dart/issues/31. dart2 has replaced dart

Stacktrace is showing that you're hitting default generator, not DartCodeGenerator, because you're using unknown generator.

gibahjoe commented 3 years ago

fixed in version v2.2.0