OpenAPITools / OpenAPITools/openapi-generator
[Dart-dio] Not correct to processing any response other than json.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
openapi-generator-cli 6.4.0
dio: ^5.0.0
If spec has "schema=string" API method will throw exception.
"responses": {
"200": {
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
The error is in this line
https://github.com/OpenAPITools/openapi-generator/blob/c81ff5801d0af944a3012a85e4e47d0813484b6f/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache#L108
I think it has to be
final _response = await _dio.request<{{{returnType}}}{{^returnType}}void{{/returnType}}>(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache at the referenced request construction. Reproduce generation from a spec with a text/plain string response and verify that the generated Dart Dio client uses the declared return type instead of assuming JSON; done means the generated method handles that response without throwing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100