Description
Generated code has a bug when using oneOf for request bodies, you can instantiate the objects fine with their builders, but when passing them into the service for serialization, it throws the following error.
DioException [unknown]: null
Error: type '_Map<String, Object?>' is not a subtype of type 'Iterable<Object?>' in type cast
openapi-generator version
7.0.1
OpenAPI declaration file content or url
I have created a repo specifically to highlight the issue
https://github.com/JakeThomson/openapi-generator-dart-dio-issue
API spec is located here
https://github.com/JakeThomson/openapi-generator-dart-dio-issue/blob/main/api-spec.yaml
Generation Details
I run the following command from the project root
npx @openapitools/openapi-generator-cli generate -i api-spec.yaml -g dart-dio -o ./packages/openapi
Steps to reproduce
- Clone project linked above
- Run the test located in
/tests/failing_test.dart
Related issues/PRs
Suggest a fix
I haven't been able to work out how to fix it, but on the line below is where the crash happens, we are casting a map to an Iterable.
https://github.com/JakeThomson/openapi-generator-dart-dio-issue/blob/4b6a916799e9b3ec20b099e73d181fd0baa6b466/packages/openapi/lib/src/model/test_request.dart#L102
Description
Generated code has a bug when using oneOf for request bodies, you can instantiate the objects fine with their builders, but when passing them into the service for serialization, it throws the following error.
openapi-generator version
7.0.1
OpenAPI declaration file content or url
I have created a repo specifically to highlight the issue
https://github.com/JakeThomson/openapi-generator-dart-dio-issue
API spec is located here
https://github.com/JakeThomson/openapi-generator-dart-dio-issue/blob/main/api-spec.yaml
Generation Details
I run the following command from the project root
npx @openapitools/openapi-generator-cli generate -i api-spec.yaml -g dart-dio -o ./packages/openapiSteps to reproduce
/tests/failing_test.dartRelated issues/PRs
Suggest a fix
I haven't been able to work out how to fix it, but on the line below is where the crash happens, we are casting a map to an Iterable.
https://github.com/JakeThomson/openapi-generator-dart-dio-issue/blob/4b6a916799e9b3ec20b099e73d181fd0baa6b466/packages/openapi/lib/src/model/test_request.dart#L102