elixir-maru / maru

Elixir RESTful Framework
https://maru.readme.io
BSD 3-Clause "New" or "Revised" License
1.32k stars 85 forks source link

Array as root parameter #121

Closed mlankenau closed 5 years ago

mlankenau commented 5 years ago

We have to build an endpoint (format defined by third party) that receives an array at the root of the json message.

[ {"foo": "bar"}, {"foo": "bar"} ]

I don't see how to define this parameter in Maru. As a workaround I take the json directly from conn.params._json which is not so nice.

falood commented 5 years ago

this is designed by plug https://hexdocs.pm/plug/Plug.Parsers.JSON.html , for now I think you have to use

params do
  requires :_json, type: List[xxx]
end
mlankenau commented 5 years ago

Thx, will try that...