diff --git a/CHANGES.md b/CHANGES.md index fbc15e50..7f5d6ba2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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)) diff --git a/stac_fastapi/api/stac_fastapi/api/models.py b/stac_fastapi/api/stac_fastapi/api/models.py index 5a239b9f..d2e06abc 100644 --- a/stac_fastapi/api/stac_fastapi/api/models.py +++ b/stac_fastapi/api/stac_fastapi/api/models.py @@ -14,6 +14,7 @@ APIRequest, BaseSearchGetRequest, BaseSearchPostRequest, + Limit, _bbox_converter, _datetime_converter, ) @@ -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 diff --git a/stac_fastapi/types/stac_fastapi/types/search.py b/stac_fastapi/types/stac_fastapi/types/search.py index 064ae10c..cfa8baf9 100644 --- a/stac_fastapi/types/stac_fastapi/types/search.py +++ b/stac_fastapi/types/stac_fastapi/types/search.py @@ -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) @@ -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 )