Skip to content

Commit

Permalink
Merge pull request #148 from Alexander-N/exclusive-minimum
Browse files Browse the repository at this point in the history
Replace gt=0 with ge=1 to avoid problems with exclusiveMinimum
  • Loading branch information
uriyyo authored Jul 21, 2021
2 parents c596bb0 + dda66e1 commit f5fdfcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ T = TypeVar("T")


class Params(BaseParams):
size: int = Query(500, gt=0, le=1_000, description="Page size")
size: int = Query(500, ge=1, le=1_000, description="Page size")


class Page(BasePage[T], Generic[T]):
Expand Down
8 changes: 4 additions & 4 deletions fastapi_pagination/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@


class Params(BaseModel, AbstractParams):
page: int = Query(1, gt=0, description="Page number")
size: int = Query(50, gt=0, le=100, description="Page size")
page: int = Query(1, ge=1, description="Page number")
size: int = Query(50, ge=1, le=100, description="Page size")

def to_raw_params(self) -> RawParams:
return RawParams(
Expand All @@ -29,8 +29,8 @@ def __init__(self, **kwargs: Any) -> None: # pragma: no cover


class Page(BasePage[T], Generic[T]):
page: conint(gt=0) # type: ignore
size: conint(gt=0) # type: ignore
page: conint(ge=1) # type: ignore
size: conint(ge=1) # type: ignore

__params_type__ = Params

Expand Down
4 changes: 2 additions & 2 deletions fastapi_pagination/limit_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class LimitOffsetParams(BaseModel, AbstractParams):
limit: int = Query(50, gt=0, le=100, description="Page size limit")
limit: int = Query(50, ge=1, le=100, description="Page size limit")
offset: int = Query(0, ge=0, description="Page offset")

def to_raw_params(self) -> RawParams:
Expand All @@ -24,7 +24,7 @@ def to_raw_params(self) -> RawParams:


class LimitOffsetPage(BasePage[T], Generic[T]):
limit: conint(gt=0) # type: ignore
limit: conint(ge=1) # type: ignore
offset: conint(ge=0) # type: ignore

__params_type__ = LimitOffsetParams
Expand Down

0 comments on commit f5fdfcd

Please sign in to comment.