openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[dart] [dart-dio] Support Dart3

Open tadaskay opened this issue 1 year ago • 9 comments

Support Dart3 SDK.

cc tech: @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)

PR checklist

  • [x] Read the contribution guidelines.
  • [x] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • [x] Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH) Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • [x] File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • [x] If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

tadaskay avatar Feb 29 '24 13:02 tadaskay

Might also update the readme. right now it states it only generates a 2x client, but I assume this PR makes it generate 3 (at least I am hoping so).

https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/dart.md

marc-wilson avatar Mar 01 '24 02:03 marc-wilson

Might also update the readme. right now it states it only generates a 2x client, but I assume this PR makes it generate 3 (at least I am hoping so).

https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/dart.md

Removed version numbers as it is now compatible with both 2.x and 3.x.

Also bumped SDK to >= 2.12 instead of >=2.6, because with the latter it prints the following error on 3.x SDK:

dart pub get
Resolving dependencies...
The lower bound of "sdk: '>=2.6.0 <4.0.0'" must be 2.12.0'
or higher to enable null safety.

The current Dart SDK (3.3.0) only supports null safety.

For details, see https://dart.dev/null-safety

tadaskay avatar Mar 01 '24 12:03 tadaskay

Thanks! Did you attempt to update they keywords file based one Dart 3.3.0 and there are just no changes?

kuhnroyal avatar Mar 01 '24 12:03 kuhnroyal

Thanks! Did you attempt to update they keywords file based one Dart 3.3.0 and there are just no changes?

Thanks, I was not aware of that file. Updated the keywords in the last commit.

tadaskay avatar Mar 04 '24 09:03 tadaskay

Would be great to get this completed!

marc-wilson avatar Apr 16 '24 21:04 marc-wilson

shall we also update the workflow to test with dart3: https://github.com/OpenAPITools/openapi-generator/actions/runs/8552245804/workflow?pr=18001#L35 so that both dart2 and 3 are tested in the CI workflows?

wing328 avatar Apr 18 '24 14:04 wing328

Any way we can get this finished? I would really like to use this!

marc-wilson avatar Apr 25 '24 15:04 marc-wilson

@marc-wilson have you tested this change locally? does it work for you using Dart3?

we don't have dart 3 test in the workflow at the moment

wing328 avatar Apr 25 '24 15:04 wing328

I have not. I'm not familiar with what it takes to clone the repo and go through the testing process.

If there is a concern around stability and you are requesting help for testing, I can take a look. But, mainly just a champion for dart 3 support as i'm currently writing out api clients manually for dart.

marc-wilson avatar Apr 25 '24 15:04 marc-wilson

@marc-wilson are you familiar with github workflow?

can you help file a PR on top of this one to update https://github.com/OpenAPITools/openapi-generator/actions/runs/8552245804/workflow?pr=18001#L35 to test both dart 2 and 3?

wing328 avatar Apr 28 '24 13:04 wing328

I've just merged it. Please give it a try with dart2 and 3 with the latest snapshot build when you've time.

snapshot build can be found in the project's readme.

wing328 avatar Apr 28 '24 14:04 wing328

Docs should get regenerated

simPod avatar Apr 28 '24 20:04 simPod

@simPod done: https://openapi-generator.tech/docs/generators/dart/

wing328 avatar Apr 29 '24 01:04 wing328

I don't know if this the right place for my question but this PR was the latest work on the dart generator I found.

It seems that the dart generator is using a fairly outdated version of the http library (http: '>=0.13.0 <0.14.0') which in my case clashed with the latest version used by other dependencies (1.2.1). Did I miss a configuration parameter or is this something that needs to be fixed with the generator?

AndreBerzun avatar May 12 '24 20:05 AndreBerzun

or is this something that needs to be fixed with the generator?

do you mind filing a PR to update http library to newer version?

wing328 avatar May 13 '24 04:05 wing328