Bug Report Checklist
Description
The recent addition of copy_with_extension has caused code generation to fail. This is because copy_with_extension requires Dart 3.8, but the version constraint in the templated pubspec.yaml is 3.5.0.
Example error:
log output for json_serializable on lib/src/model/additional_properties_class.dart
W The language version (3.5.0) of this package (openapi) does not match the required range `^3.8.0`.
Edit pubspec.yaml to include an SDK constraint of at least ^3.8.0.
environment:
sdk: ^3.8.0
E An error `FormatterException` occurred while formatting the generated source for
`package:openapi/src/model/additional_properties_class.dart`
which was output to
`lib/src/model/additional_properties_class.json_serializable.g.part`.
This may indicate an issue in the generator, the input source code, or in the
source formatter.
Could not format because the source could not be parsed:
line 19, column 25 of .: This requires the 'null-aware-elements' language feature to be enabled.
╷
19 │ 'map_property': ?instance.mapProperty,
│ ^
╵
openapi-generator version
7.15.0, and this issue exists on master branch,
OpenAPI declaration file content or url
N/A - this issue can be verified with the petstore example in the repo.
Steps to reproduce
This issue can be verified using the petstore sample
- Checkout OpenAPI Generator on master
cd samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable
dart pub get
dart run build_runner build --delete-conflicting-outputs
See the errors
Related issues/PRs
#21667
#21665
Suggest a fix
Requiring a minimum of Dart 3.8.0 fixes the issue for us. Unfortunately it looks like the petstore example still has other build issues. eg:
pubspec.mustache
environment:
sdk: '>={{^useJsonSerializable}}2.18.0{{/useJsonSerializable}}{{#useJsonSerializable}}3.8.0{{/useJsonSerializable}} <4.0.0'
Bug Report Checklist
Description
The recent addition of copy_with_extension has caused code generation to fail. This is because copy_with_extension requires Dart 3.8, but the version constraint in the templated pubspec.yaml is 3.5.0.
Example error:
openapi-generator version
7.15.0, and this issue exists on
masterbranch,OpenAPI declaration file content or url
N/A - this issue can be verified with the petstore example in the repo.
Steps to reproduce
This issue can be verified using the petstore sample
cd samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializabledart pub getdart run build_runner build --delete-conflicting-outputsSee the errors
Related issues/PRs
#21667
#21665
Suggest a fix
Requiring a minimum of Dart 3.8.0 fixes the issue for us. Unfortunately it looks like the petstore example still has other build issues. eg:
pubspec.mustache