Usage:
This plug is used to validate pagination parameters page
, offset
, and limit
.
page
- must be a positive number
offset
- must be a positive number
limit
- must be a positive number and must be under the defined record limit (see below)
When using the plug, the default limit
is defined to fetch 1000 records or if the
limit is defined as part of a config value.
solicit: [pagination_max_limit: 2000]
Example usage:
plug(Solicit.Plugs.Validation.PaginationParams)
You also have the option to define what you would like the max_limit
ceiling to be
when fetching records by passing an option
plug(Solicit.Plugs.Validation.PaginationParams, [max_limit: 5])
Usage:
This plug is used to validate query parameters have a value set.
plug(Solicit.Plugs.Validation.QueryParams)
Examples:
If providing query parameters such as
GET /api?foo=
we will return the equivalent of
GET /api
If providing query parameters such as
GET /api?foo=&bar=123
we will return the equivalent of
GET /api?bar=123