View Source OpenApiSpex.Paths (open_api_spex v3.21.1)

Defines the OpenApiSpex.Paths.t type.

Summary

Functions

Create a Paths map from the routes in the given router module.

Create a Paths map from a list of routes.

Types

@type path() :: String.t()

Paths Object

Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

@type t() :: %{required(path()) => OpenApiSpex.PathItem.t()}

Functions

@spec from_router(module()) :: t()

Create a Paths map from the routes in the given router module.

@spec from_routes([OpenApiSpex.PathItem.route()]) :: t()

Create a Paths map from a list of routes.

Example

Paths.from_routes([
  %{path: "/v1/contacts", verb: :post, plug: MyAppWeb.V1.ContactController, plug_opts: :create}
])