Skip to content

Commit

Permalink
[Patch] forward prefix to ItemCollectionFilterExtension.router (#796
Browse files Browse the repository at this point in the history
)

* forward `prefix` to `ItemCollectionFilterExtension.router`

* Bump version: 5.0.1 → 5.0.2
  • Loading branch information
vincentsarago authored Jan 30, 2025
1 parent 00cb445 commit c71a355
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [5.0.2] - 2025-01-30

### Fixed

- forward `prefix` to `ItemCollectionFilterExtension.router`

## [5.0.1] - 2025-01-30

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.1
5.0.2
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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<major>\\d+)\\.
(?P<minor>\\d+)\\.
Expand Down
2 changes: 1 addition & 1 deletion stac_fastapi/api/stac_fastapi/api/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Library version."""

__version__ = "5.0.1"
__version__ = "5.0.2"
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion stac_fastapi/extensions/stac_fastapi/extensions/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Library version."""

__version__ = "5.0.1"
__version__ = "5.0.2"
26 changes: 26 additions & 0 deletions stac_fastapi/extensions/tests/test_filter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion stac_fastapi/types/stac_fastapi/types/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Library version."""

__version__ = "5.0.1"
__version__ = "5.0.2"

0 comments on commit c71a355

Please sign in to comment.