Params Parser for Phoenix
Maru v0.10.5 bring params parser for phoenix by adding one line use Maru.Parameter.Phoenix
to phoenix controller.
defmodule Controller do
use MyApp.Web, :controller
use Maru.Parameter.Phoenix
params do
requires :foo, type: Integer
optional :bar, type: List do
optional :baz
end
end
def index(conn, params) do
...
end
params do
optional :bar, type: Integer
optional :baz, type: Map do
optional :foo
end
mutually_exclusive [:bar, :baz]
end
def create(conn, params) do
...
end
end
Updated less than a minute ago