EndPointBlank.Phoenix.Versioned (end_point_blank_elixir v0.3.1)

Copy Markdown

Macro that adds per-action version metadata to a Phoenix controller.

Usage

defmodule MyAppWeb.BooksController do
  use Phoenix.Controller
  use EndPointBlank.Phoenix.Versioned

  version_of :index, ["v1", "v2"], state: "Current"
  version_of :index, ["v0"],       state: "Deprecated"

  def index(conn, _params), do: ...
end

Multiple calls for the same action are merged — repeating a state appends (de-duped) versions, and additional states are added alongside the existing ones.

The registered metadata is read by EndPointBlank.Phoenix.EndpointRegistrar when it builds the endpoint list sent to the EndPointBlank API at startup.

Summary

Functions

Declares version metadata for action. Stores it as a nested %{action => %{state => versions}} map, merging with any prior declaration for the same action.

Functions

version_of(action, versions, opts \\ [])

(macro)

Declares version metadata for action. Stores it as a nested %{action => %{state => versions}} map, merging with any prior declaration for the same action.

Options

  • :state - e.g. "Current", "Deprecated", "In Development" (default: "Current")