From 217b211978d9311c8e1164296c971be9da394d5c Mon Sep 17 00:00:00 2001 From: c4710n Date: Tue, 30 Jul 2024 10:57:10 +0800 Subject: [PATCH] improve docs of restricting pagination types 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. --- lib/flop/schema.ex | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/flop/schema.ex b/lib/flop/schema.ex index 3ce6570..938afd8 100644 --- a/lib/flop/schema.ex +++ b/lib/flop/schema.ex @@ -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, @@ -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