Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Patch] forward prefix to ItemCollectionFilterExtension.router #796

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"