-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Hi AJ, thank you for making this codegen for Elixir! I was running into a problem and was wondering if you could help/provide advice?
In my project OpenAPI spec, I am using a GET parameter specified like this:
get:
parameters:
...
- name: listOfIds
in: path
required: true
schema:
type: array
items:
type: string
format: uuid
minItems: 1
explode: false
style: simple
When I code generate, the typespec of the module says that the type listOfIds is of [String.t()] which is correct, however the generated module is like the following:
@spec module([String.t()], keyword) ::
{:ok, SomeOutput.t()} | {:error, SomeError.t()}
def module(listOfIds, opts \\ []) do
client = opts[:client] || @default_client
query = Keyword.take(opts, [:pageSize, :pageToken])
client.request(%{
args: [listOfIds: listOfIds],
call: {Clients.CoreApi.MyCall, :module},
url: "/listOfIds/#{listOfIds}",
method: :get,
query: query,
response: [
{200, {Clients.CoreApi.SomeOutput, :t}},
{401, :null},
{404, :null}
],
opts: opts
})
end
If listOfIds = [AAAA, BBBB, CCCC, DDDD], I expect that url should parse to /listOfIds/AAAA,BBBB,CCCC,DDDD according to the OpenAPI Spec. However, what I actually get is /listOfIds/AAAABBBBCCCCDDDD (no comma seperation).
My current work around is to pre-join (Enum.join(listOfIds, ",")) my listOfIds before passing it into the module, but was wondering if there is way for the codegen to join array parameters, given that the typespec is aware that listOfIds is an array