From 3c4ce2e0b8616d388b94a9cfb2a28e5d44ada29a Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Fri, 11 Oct 2024 11:27:13 +0200 Subject: [PATCH] add numberMatched/Returned properties in model (#759) --- CHANGES.md | 8 ++++++++ docs/src/tips-and-tricks.md | 17 ----------------- stac_fastapi/types/stac_fastapi/types/stac.py | 3 ++- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 887bfdfc..2b9117b1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,14 @@ ## [Unreleased] +### Removed + +* Remove deprecated `context` property in `types.stac.ItemCollection` model + +### Added + +* Add `numberMatched` and `numberReturned` properties in `types.stac.ItemCollection` model + ## [3.0.3] - 2024-10-09 ### Removed diff --git a/docs/src/tips-and-tricks.md b/docs/src/tips-and-tricks.md index 5398112e..c47433d0 100644 --- a/docs/src/tips-and-tricks.md +++ b/docs/src/tips-and-tricks.md @@ -20,23 +20,6 @@ middlewares=[lambda app: CORSMiddleware(app, allow_origins=["*"])] If needed, you can edit the `allow_origins` parameter to only allow CORS requests from specific origins. -## Enable the Context extension - -!!! Warning - - The `ContextExtension` is deprecated and will be removed in 3.0. See https://github.com/radiantearth/stac-api-spec/issues/396 - -The Context STAC extension provides information on the number of items matched and returned from a STAC search. -This is required by various other STAC-related tools, such as the pystac command-line client. -To enable the extension, edit your backend's `app.py` and add the following import: - -```python -from stac_fastapi.extensions.core.context import ContextExtension -``` - - -and then edit the `api = StacApi(...` call to add `ContextExtension()` to the list given as the `extensions` parameter. - ## Set API title, description and version For the landing page, you can set the API title, description and version using environment variables. diff --git a/stac_fastapi/types/stac_fastapi/types/stac.py b/stac_fastapi/types/stac_fastapi/types/stac.py index b9c93fd8..cb353867 100644 --- a/stac_fastapi/types/stac_fastapi/types/stac.py +++ b/stac_fastapi/types/stac_fastapi/types/stac.py @@ -73,7 +73,8 @@ class ItemCollection(TypedDict, total=False): type: Literal["FeatureCollection"] features: List[Item] links: List[Dict[str, Any]] - context: Optional[Dict[str, int]] + numberMatched: Optional[int] + numberReturned: Optional[int] class Collections(TypedDict, total=False):