Skip to content

Commit

Permalink
use same Limit object for collection_items and get_search request model
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jul 23, 2024
1 parent 4df4947 commit 3ce69fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

### Changed

* add more openapi metadata in input models [#734](https://github.com/stac-utils/stac-fastapi/pull/734)
* Add more openapi metadata in input models [#734](https://github.com/stac-utils/stac-fastapi/pull/734)
* Use same `Limit` (capped to `10_000`) for `/items` and `GET - /search` input models ([#737](https://github.com/stac-utils/stac-fastapi/pull/737))

### Added

* Add Free-text Extension ([#655](https://github.com/stac-utils/stac-fastapi/pull/655))
* Add Collection-Search Extension ([#736](https://github.com/stac-utils/stac-fastapi/pull/736))

Expand Down
8 changes: 7 additions & 1 deletion stac_fastapi/api/stac_fastapi/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
APIRequest,
BaseSearchGetRequest,
BaseSearchPostRequest,
Limit,
_bbox_converter,
_datetime_converter,
)
Expand Down Expand Up @@ -113,7 +114,12 @@ class ItemCollectionUri(APIRequest):
"""Get item collection."""

collection_id: Annotated[str, Path(description="Collection ID")] = attr.ib()
limit: Annotated[int, Query()] = attr.ib(default=10)
limit: Annotated[
Optional[Limit],
Query(
description="Limits the number of results that are included in each page of the response (capped to 10_000)." # noqa: E501
),
] = attr.ib(default=10)
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter)
datetime: Optional[DateTimeType] = attr.ib(
default=None, converter=_datetime_converter
Expand Down
6 changes: 3 additions & 3 deletions stac_fastapi/types/stac_fastapi/types/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ class BaseSearchGetRequest(APIRequest):
default=None, converter=_datetime_converter
)
limit: Annotated[
Optional[int],
Optional[Limit],
Query(
description="Limits the number of results that are included in each page of the response." # noqa: E501
description="Limits the number of results that are included in each page of the response (capped to 10_000)." # noqa: E501
),
] = attr.ib(default=10)

Expand All @@ -186,5 +186,5 @@ class BaseSearchPostRequest(Search):

limit: Optional[Limit] = Field(
10,
description="Limits the number of results that are included in each page of the response.", # noqa: E501
description="Limits the number of results that are included in each page of the response (capped to 10_000).", # noqa: E501
)

0 comments on commit 3ce69fb

Please sign in to comment.