From f311dc620d2a11df397f8d95c17e15483b9e302c Mon Sep 17 00:00:00 2001 From: James Fisher <85769594+jamesfisher-gis@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:43:29 -0400 Subject: [PATCH] Remove the Filter Extension dependency from Aggregation Extension requests (#716) * aggregations type * aggregations type * remove filter extension dependency * linting * update changelog --- CHANGES.md | 4 ++++ .../extensions/core/aggregation/request.py | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3d63fea6..ea020992 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,10 @@ * Updated default filter language in filter extension's POST search request model to match the extension's documentation [#711](https://github.com/stac-utils/stac-fastapi/issues/711) +### Removed + +* Removed the Filter Extension depenency from `AggregationExtensionPostRequest` and `AggregationExtensionGetRequest` [#716](https://github.com/stac-utils/stac-fastapi/pull/716) + ## [3.0.0a3] - 2024-06-13 ### Added diff --git a/stac_fastapi/extensions/stac_fastapi/extensions/core/aggregation/request.py b/stac_fastapi/extensions/stac_fastapi/extensions/core/aggregation/request.py index fcab3323..08ebe0cf 100644 --- a/stac_fastapi/extensions/stac_fastapi/extensions/core/aggregation/request.py +++ b/stac_fastapi/extensions/stac_fastapi/extensions/core/aggregation/request.py @@ -1,24 +1,24 @@ """Request model for the Aggregation extension.""" -from typing import List, Optional, Union +from typing import List, Optional import attr -from stac_fastapi.extensions.core.filter.request import ( - FilterExtensionGetRequest, - FilterExtensionPostRequest, +from stac_fastapi.types.search import ( + BaseSearchGetRequest, + BaseSearchPostRequest, + str2list, ) -from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest @attr.s -class AggregationExtensionGetRequest(BaseSearchGetRequest, FilterExtensionGetRequest): +class AggregationExtensionGetRequest(BaseSearchGetRequest): """Aggregation Extension GET request model.""" - aggregations: Optional[str] = attr.ib(default=None) + aggregations: Optional[str] = attr.ib(default=None, converter=str2list) -class AggregationExtensionPostRequest(BaseSearchPostRequest, FilterExtensionPostRequest): +class AggregationExtensionPostRequest(BaseSearchPostRequest): """Aggregation Extension POST request model.""" - aggregations: Optional[Union[str, List[str]]] = attr.ib(default=None) + aggregations: Optional[List[str]] = attr.ib(default=None)