OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am trying to generate the client-side code of an OpenAPI API using the openapi-generator-cli with the Dart-Dio generator. However, I am encountering errors during the generation process. The API JSON provided is just a small part of the whole API, and we have already successfully generated the API client code using the typescript-angular generator for Angular without any issues.
I've also tried using the dart openapi generator, but this also did not work out. I think I would like to have it with dart-dio, since this seems to be the most liked option by the flutter community.
Target of URI hasn't been generated: 'package:openapi/src/model/token_info.g.dart'.
Try running the generator that will generate the file referenced by the URI. dart([uri_has_not_been_generated](https://dart.dev/diagnostics/uri_has_not_been_generated))
TokenInfoBuilder is also underlined in red everywhere and shows the following error when hovering over:
Undefined class 'TokenInfoBuilder'.
Try changing the name to the name of an existing class, or creating a class with the name 'TokenInfoBuilder'. dart([undefined_class](https://dart.dev/diagnostics/undefined_class))
Steps to reproduce
Since this API client code generation is created as a package, I think there are no steps to reproduce this other than just using the shell script. You may have to install the openapi-generator-cli and flutter.
As a disclaimer, I must admit that I am more of a beginner when it comes to Flutter. If you have any questions or suggestions regarding the problem and the provided logs, please feel free to ask. I will do my best to address any queries and work towards finding a solution. Thank you for taking the time to review my problem and for any assistance you can provide!
Bug Report Checklist
Description
I am trying to generate the client-side code of an OpenAPI API using the openapi-generator-cli with the Dart-Dio generator. However, I am encountering errors during the generation process. The API JSON provided is just a small part of the whole API, and we have already successfully generated the API client code using the typescript-angular generator for Angular without any issues.
openapi-generator version
Should be 6.6.0
Contents of the
openapitools.json
file:OpenAPI declaration file content or url
Link to OpenAPI declaration file
Generation Details
Script I am using for generation:
I've also tried using the dart openapi generator, but this also did not work out. I think I would like to have it with dart-dio, since this seems to be the most liked option by the flutter community.
Logs after running command: Logs
Contents of the generated pubspec.yaml file:
pubspect.yaml
Expected Outcome: I expect the Dart client-side code to be successfully generated without any syntax errors.
Actual Outcome: The generation process fails with syntax errors in the token_info.dart file.
Contents of the
token_info.dart
file:token_info.dart
Error when hovering over part 'token_info.g.dart:
TokenInfoBuilder
is also underlined in red everywhere and shows the following error when hovering over:Steps to reproduce
Since this API client code generation is created as a package, I think there are no steps to reproduce this other than just using the shell script. You may have to install the openapi-generator-cli and flutter.
Related issues/PRs
This could be a similar issue
Suggest a fix
As a disclaimer, I must admit that I am more of a beginner when it comes to Flutter. If you have any questions or suggestions regarding the problem and the provided logs, please feel free to ask. I will do my best to address any queries and work towards finding a solution. Thank you for taking the time to review my problem and for any assistance you can provide!