Wayfinder.Processor.BuildParams (Wayfinder Ex v0.1.2)
View SourceWe get for each route a map of all their arguments and if they are optional or not.
Example: get "/users/:id", UserController, :show get "/users/:id/:name", UserController, :show
In this case :id
is required and :name
is optional.
Summary
Types
@type counts_acc() :: %{ required(http_method()) => %{required(param_name()) => param_count()} }
@type http_method() :: String.t()
@type method_acc() :: {counts_acc(), totals_acc()}
@type param_count() :: non_neg_integer()
@type param_name() :: String.t()
@type totals_acc() :: %{required(http_method()) => non_neg_integer()}
Functions
@spec build([Phoenix.Router.Route.t()], [{String.t(), atom()}]) :: Wayfinder.Processor.Route.params_by_method()
@spec build_param_spec(String.t(), [{String.t(), atom()}], any()) :: Wayfinder.Processor.Route.param_spec()
@spec params_count(Wayfinder.Processor.Route.t() | Phoenix.Router.Route.t()) :: non_neg_integer()