[BUG] Elixir generated client does not work with optional request body
Created by: boolafish
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? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
If the request body of an api is optional, the generated elixir client cannot override the param correctly with the params if given.
For instance, one can do
Api.Account.account_get_transactions(
Connection.new()
)
or
Api.Account.account_get_transactions(
Connection.new(),
[{:"GetAllTransactionsBodySchema", %{}}]
)
But no matter how we pass params into the function, it would not have any effect: (with limit 1, the response should only return 1 item)
Api.Account.account_get_transactions(
Connection.new(),
[{:"GetAllTransactionsBodySchema", %{
limit: 1
}}]
)
or
Api.Account.account_get_transactions(
Connection.new(),
[{:limit, 1}]
)
openapi-generator version
latest docker
OpenAPI declaration file content or url
Command line used for generation
see this make command: https://github.com/omisego/elixir-omg/blob/862a6adfd436fbb1316be760ac6b72090127a115/priv/Makefile#L20
Steps to reproduce
- clone elixir-omg
git clone https://github.com/omisego/elixir-omg
- run a local service in a tab
make init_test
make docker-nuke
docker-compose up
- in another tab:
cd elixir-omg/priv
mix deps.get
make generate_api_code
iex -S mix
alias WatcherInfoAPI.Connection
alias WatcherInfoAPI.Api
Api.Account.account_get_transactions(
Connection.new(),
[{:"GetAllTransactionsBodySchema", %{
limit: 1
}}]
)
Related issues/PRs
Workaround ourself: https://github.com/omisego/elixir-omg/pull/1302
Suggest a fix
N/A