Skip to content

Commit

Permalink
improve docs of restricting pagination types
Browse files Browse the repository at this point in the history
The commit includes 2 main changes.

+ The old one mixes pagination types and paramaters. At first glance,
  it can be very confusing. So, I change the doc to not mention related
  parameters at all. And, the parameters will be mentioned in the doc
  of `t:Flop.pagination_type/0`.
+ Note that the `nil` is the default value. This tells developers that
  they don't need to do anything if they want to support all pagination
  types.
  • Loading branch information
c4710n committed Jul 30, 2024
1 parent a60e4ea commit 217b211
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/flop/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ defprotocol Flop.Schema do
## Restricting pagination types
By default, `page`/`page_size`, `offset`/`limit` and cursor-based pagination
(`first`/`after` and `last`/`before`) are enabled. If you wish to restrict the
pagination type for a schema, you can set the `pagination_types` option.
By default, all supported pagination types (`t:Flop.pagination_type/0`) are
enabled. If you wish to restrict the pagination type for a schema, you can
set the `:pagination_types` option.
@derive {
Flop.Schema,
Expand All @@ -106,8 +106,9 @@ defprotocol Flop.Schema do
pagination_types: [:first, :last]
}
See also `t:Flop.option/0` and `t:Flop.pagination_type/0`. Setting the value
to `nil` allows all pagination types.
Setting the value to `nil` (default) allows all pagination types.
See also `t:Flop.option/0`.
## Alias fields
Expand Down

0 comments on commit 217b211

Please sign in to comment.