View Source OpenApiSpex.Paths (open_api_spex v3.18.3)

Defines the OpenApiSpex.Paths.t type.

Link to this section Summary

Functions

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

Create a Paths map from a list of routes.

Link to this section 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()}

Link to this section 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

Example

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