diff --git a/CHANGES.md b/CHANGES.md index 91f88d31..8d7a3f2d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [5.0.2] - 2025-01-30 + +### Fixed + +- forward `prefix` to `ItemCollectionFilterExtension.router` + ## [5.0.1] - 2025-01-30 ### Fixed diff --git a/VERSION b/VERSION index 6b244dcd..a1ef0cae 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.0.1 +5.0.2 diff --git a/pyproject.toml b/pyproject.toml index b566922d..eccaa956 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ section-order = ["future", "standard-library", "third-party", "first-party", "lo quote-style = "double" [tool.bumpversion] -current_version = "5.0.1" +current_version = "5.0.2" parse = """(?x) (?P\\d+)\\. (?P\\d+)\\. diff --git a/stac_fastapi/api/stac_fastapi/api/version.py b/stac_fastapi/api/stac_fastapi/api/version.py index b49655b3..59266165 100644 --- a/stac_fastapi/api/stac_fastapi/api/version.py +++ b/stac_fastapi/api/stac_fastapi/api/version.py @@ -1,3 +1,3 @@ """Library version.""" -__version__ = "5.0.1" +__version__ = "5.0.2" diff --git a/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py b/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py index d182dcf3..7e8d7f57 100644 --- a/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py +++ b/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py @@ -192,6 +192,7 @@ def register(self, app: FastAPI) -> None: Returns: None """ + self.router.prefix = app.state.router_prefix self.router.add_api_route( name="Collection Queryables", path="/collections/{collection_id}/queryables", diff --git a/stac_fastapi/extensions/stac_fastapi/extensions/version.py b/stac_fastapi/extensions/stac_fastapi/extensions/version.py index b49655b3..59266165 100644 --- a/stac_fastapi/extensions/stac_fastapi/extensions/version.py +++ b/stac_fastapi/extensions/stac_fastapi/extensions/version.py @@ -1,3 +1,3 @@ """Library version.""" -__version__ = "5.0.1" +__version__ = "5.0.2" diff --git a/stac_fastapi/extensions/tests/test_filter.py b/stac_fastapi/extensions/tests/test_filter.py index bc8b902e..8dc485e6 100644 --- a/stac_fastapi/extensions/tests/test_filter.py +++ b/stac_fastapi/extensions/tests/test_filter.py @@ -1,6 +1,7 @@ from typing import Iterator import pytest +from fastapi import APIRouter from starlette.testclient import TestClient from stac_fastapi.api.app import StacApi @@ -185,3 +186,28 @@ def test_search_filter_get(client_name, request): assert response.is_success, response.json() response_dict = response.json() assert response_dict["collections"] == ["collection1", "collection2"] + + +@pytest.mark.parametrize("prefix", ["", "/a_prefix"]) +def test_multi_ext_prefix(prefix): + settings = ApiSettings() + extensions = [ + SearchFilterExtension(), + ItemCollectionFilterExtension(), + # Technically `CollectionSearchFilterExtension` + # shouldn't be registered to the application but to the collection-search class + CollectionSearchFilterExtension(), + ] + + api = StacApi( + settings=settings, + router=APIRouter(prefix=prefix), + client=DummyCoreClient(), + extensions=extensions, + search_get_request_model=create_get_request_model([SearchFilterExtension()]), + search_post_request_model=create_post_request_model([SearchFilterExtension()]), + ) + with TestClient(api.app, base_url="http://stac.io") as client: + queryables = client.get(f"{prefix}/queryables") + assert queryables.status_code == 200, queryables.json() + assert queryables.headers["content-type"] == "application/schema+json" diff --git a/stac_fastapi/types/stac_fastapi/types/version.py b/stac_fastapi/types/stac_fastapi/types/version.py index b49655b3..59266165 100644 --- a/stac_fastapi/types/stac_fastapi/types/version.py +++ b/stac_fastapi/types/stac_fastapi/types/version.py @@ -1,3 +1,3 @@ """Library version.""" -__version__ = "5.0.1" +__version__ = "5.0.2"