Skip to content

Commit

Permalink
Fix convert_params/1
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasbair committed Oct 4, 2024
1 parent 26a5b6c commit d4df878
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/code_gen/code_generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,18 @@ defmodule ExOanda.CodeGenerator do
|> Enum.into(%{})
|> Recase.Enumerable.convert_keys(&Recase.to_camel/1)
|> Enum.map(fn {k, v} ->
k = maybe_convert_to_string(k)

case String.ends_with?(k, "Id") do
true -> {String.replace(k, "Id", "ID"), v}
false -> {k, v}
end
end)
end

def maybe_convert_to_string(val) when is_atom(val), do: Atom.to_string(val)
def maybe_convert_to_string(val), do: val

defp generate_module_name(module_name), do: Module.concat([ExOanda, module_name])

defp format_args(args) do
Expand Down

0 comments on commit d4df878

Please sign in to comment.