View Source Routes.Transformer (routes v0.2.0)

Transforms Phoenix route maps into simplified route structures.

Provides functionality to convert complex Phoenix route maps into a more normalized format that is easier to work with.

Summary

Functions

Transforms a Phoenix route map into a simplified route structure.

Types

@type route_map() :: %{
  path: String.t(),
  plug_opts: atom(),
  verb: atom(),
  plug: module()
}
@type transformed_route() :: %{
  name: String.t(),
  action: atom(),
  path: String.t(),
  method: String.t(),
  controller: String.t(),
  params: [String.t()]
}

Functions

@spec transform(route_map()) :: transformed_route() | nil

Transforms a Phoenix route map into a simplified route structure.

Takes a route map containing the path, plug options, HTTP verb and plug module, and converts it into a transformed route with normalized fields.

Returns nil if the input is invalid or cannot be transformed.