[BUG] [DART][DART-DIO] API calls using parameters that take Lists are not being made correctly
Created by: frameset
Bug Report Checklist
- [
✔ ] Have you provided a full/minimal spec to reproduce the issue? - [
✔ ] Have you validated the input using an OpenAPI validator (example)? - [
✔ ] What's the version of OpenAPI Generator used? 4.3.1 - [
✔ ] Have you search for related issues/PRs? Yes, without fruition - [
✔ ] What's the actual output vs expected output?
Description
I've got an API generated using the dart-dio class that has an API call where some of the parameters take lists of strings. On those parameters the API call seems to insert [] (or the HTTP character encoding equivalent) before the = of the api request. e.g. http://komga.my.domain/api/v1/books?read_status%5B%5D=IN_PROGRESS
when it should look like:
https://komga.my.domain/api/v1/books?read_status=IN_PROGRESS
If you pass more than one item in the list, e.g. bookApi.getAllBooks(readStatus: ["IN_PROGRESS","READ"])
then the API request looks like this:
http://komga.my.domain/api/v1/books?read_status%5B%5D=IN_PROGRESS&read_status%5B%5D=READ
when it should look like this:
https://komga.my.domain/api/v1/books?read_status=READ&read_status=IN_PROGRESS
openapi-generator version
latest stable - 4.3.1
OpenAPI declaration file content or url
https://demo.komga.org/v3/api-docs/REST%20API
Command line used for generation
java -jar .\openapi-generator-cli.jar generate -i '.\REST API.json' -g dart-dio --additional-properties=dateLibrary=timemachine -o .\komga_api_client\ -c .\config.yaml
(the config.yaml merely contains some purely aesthetic parameters around branding)
I have a copy of the generated code in a github repo here - https://github.com/frameset/komga_api_client
Steps to reproduce
You could clone my github repo https://github.com/frameset/komga_client
into an android studio project, open the screens\serverhome.dart page and modify line 101 to read:
future: bookApi.getAllBooks(readStatus: ["IN_PROGRESS"]),
Then start the app in an emulator and enter the server details
Server: demo.komga.org
Username: demo@komga.org
Password: komga-demo
You may need to capture the http traffic in some way as dart devtools does not have this facility yet.
Related issues/PRs
I could not find something that closely matches the problem.
Suggest a fix
I am unsure personally, as this is beyond my understanding.