11defmodule Rolodex.Route do
22 @ moduledoc """
3- Collects metadata associated with an API route. `new/2` takes in a
4- `Phoenix.Router.Route`, finds the controller action function associated with
5- the route, and collects metadata set in the `@doc` annotations for the function.
3+ Collects metadata associated with an API route.
64
7- ## Route Annotations
5+ `new/2` takes a `Phoenix.Router.Route`, finds the controller action
6+ function associated with the route, and collects metadata set in the `@doc`
7+ annotations for the function.
88
9- Details about all the valid annotations that `new/2` will look for. Each one has
10- a default, so they each can be omitted if not needed for the current route.
9+ ### Fields
1110
12- **`desc`**
13-
14- Default: `""`
11+ * **`desc`** (Default: `""`)
1512
1613 Set via an `@doc` comment
1714
@@ -21,9 +18,7 @@ defmodule Rolodex.Route do
2118 @doc "My route description"
2219 def route(_, _), do: nil
2320
24- **`body`**
25-
26- Default: `%{}`
21+ * **`body`** *(Default: `%{}`)
2722
2823 Request body parameters. Valid inputs: `Rolodex.Schema`, a map, or a list.
2924
@@ -63,9 +58,7 @@ defmodule Rolodex.Route do
6358 ]
6459 ]
6560
66- **`headers`**
67-
68- Default: `%{}`
61+ * **`headers`** (Default: `%{}`)
6962
7063 Request headers. Valid input is a map or keyword list, where each key is a
7164 header name and each value is a description of the value in the form of a
@@ -110,16 +103,15 @@ defmodule Rolodex.Route do
110103 ]
111104 ]
112105
113- **`path_params`**
114-
115- Default: `%{}`
106+ * **`path_params`** (Default: `%{}`)
116107
117108 Parameters in the route path. Valid input is a map or keyword list, where each
118- key is a path parameter name and each value is a description of the value in the
119- form of a `Rolodex.Schema`, an atom, a map, or a list.
109+ key is a path parameter name and each value is a description of the value in
110+ the form of a `Rolodex.Schema`, an atom, a map, or a list.
120111
121- Each parameter value can also specify the following: `minimum` (default: `nil`),
122- `maximum` (default: `nil`), default (default: `nil`), and required (default: `required`).
112+ Each parameter value can also specify the following: `minimum` (default:
113+ `nil`), `maximum` (default: `nil`), default (default: `nil`), and required
114+ (default: `required`).
123115
124116 @doc [
125117 # Simplest path parameter description: a name with a concrete type
@@ -147,16 +139,15 @@ defmodule Rolodex.Route do
147139 ]
148140 ]
149141
150- **`query_params`**
151-
152- Default: `%{}`
142+ * **`query_params`** (Default: `%{}`)
153143
154144 Query parameters. Valid input is a map or keyword list, where each key is a
155145 query parameter name and each value is a description of the value in the form
156146 of a `Rolodex.Schema`, an atom, a map, or a list.
157147
158148 Each query value can also specify the following: `minimum` (default: `nil`),
159- `maximum` (default: `nil`), default (default: `nil`), and required (default: `required`).
149+ `maximum` (default: `nil`), default (default: `nil`), and required (default:
150+ `required`).
160151
161152 @doc [
162153 # Simplest query parameter description: a name with a concrete type
@@ -194,9 +185,7 @@ defmodule Rolodex.Route do
194185 ]
195186 ]
196187
197- **`responses`**
198-
199- Default: `%{}`
188+ * **`responses`** (Default: `%{}`)
200189
201190 Response(s) for the route action. Valid input is a map or keyword list, where
202191 each key is a response code and each value is a description of the response in
@@ -240,15 +229,11 @@ defmodule Rolodex.Route do
240229 }
241230 ]
242231
243- **`metadata`**
244-
245- Default: `%{}`
232+ * **`metadata`** (Default: `%{}`)
246233
247234 Any metadata for the route. Valid input is a map or keyword list.
248235
249- **`tags`**
250-
251- Default: `[]`
236+ * **`tags`** (Default: `[]`)
252237
253238 Route tags. Valid input is a list of strings.
254239
0 commit comments