Skip to content

Commit 00cb445

Browse files
Release/v5.0.1 (#795)
* add `Queryables` when SearchFilterExtension is enabled * Bump version: 5.0.0 → 5.0.1
1 parent dda302c commit 00cb445

File tree

9 files changed

+96
-52
lines changed

9 files changed

+96
-52
lines changed

CHANGES.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [5.0.1] - 2025-01-30
6+
7+
### Fixed
8+
9+
- add `Queryables` links when `SearchFilterExtension` is enabled
10+
511
## [5.0.0] - 2025-01-30
612

713
### Changed
@@ -563,7 +569,8 @@ Full changelog: https://stac-utils.github.io/stac-fastapi/migrations/v3.0.0/#cha
563569

564570
* First PyPi release!
565571

566-
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.0..main>
572+
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.1..main>
573+
[5.0.1]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.0..5.0.1>
567574
[5.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/4.0.1..5.0.0>
568575
[4.0.1]: <https://github.com/stac-utils/stac-fastapi/compare/4.0.0..4.0.1>
569576
[4.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.5..4.0.0>

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
5.0.1

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ section-order = ["future", "standard-library", "third-party", "first-party", "lo
2424
quote-style = "double"
2525

2626
[tool.bumpversion]
27-
current_version = "5.0.0"
27+
current_version = "5.0.1"
2828
parse = """(?x)
2929
(?P<major>\\d+)\\.
3030
(?P<minor>\\d+)\\.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library version."""
22

3-
__version__ = "5.0.0"
3+
__version__ = "5.0.1"

stac_fastapi/api/tests/test_app.py

+39-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
create_get_request_model,
1616
create_post_request_model,
1717
)
18-
from stac_fastapi.extensions.core import FieldsExtension, FilterExtension
18+
from stac_fastapi.extensions.core import (
19+
FieldsExtension,
20+
FilterExtension,
21+
SearchFilterExtension,
22+
)
1923
from stac_fastapi.types import stac
2024
from stac_fastapi.types.config import ApiSettings
2125
from stac_fastapi.types.core import BaseCoreClient, NumType
@@ -184,6 +188,40 @@ def get_search(
184188
)
185189

186190
assert landing.status_code == 200, landing.text
191+
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
192+
assert get_search.status_code == 200, get_search.text
193+
assert post_search.status_code == 200, post_search.text
194+
195+
test_app = app.StacApi(
196+
settings=ApiSettings(enable_response_models=validate),
197+
client=FilterClient(),
198+
search_get_request_model=create_get_request_model([SearchFilterExtension()]),
199+
search_post_request_model=create_post_request_model([SearchFilterExtension()]),
200+
extensions=[SearchFilterExtension()],
201+
)
202+
203+
with TestClient(test_app.app) as client:
204+
landing = client.get("/")
205+
get_search = client.get(
206+
"/search",
207+
params={
208+
"filter": "TEST",
209+
"filter-crs": "EPSG:4326",
210+
"filter-lang": "cql2-text",
211+
},
212+
)
213+
post_search = client.post(
214+
"/search",
215+
json={
216+
"collections": ["test"],
217+
"filter": {},
218+
"filter-crs": "EPSG:4326",
219+
"filter-lang": "cql2-json",
220+
},
221+
)
222+
223+
assert landing.status_code == 200, landing.text
224+
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
187225
assert get_search.status_code == 200, get_search.text
188226
assert post_search.status_code == 200, post_search.text
189227

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library version."""
22

3-
__version__ = "5.0.0"
3+
__version__ = "5.0.1"

stac_fastapi/extensions/tests/test_aggregation.py

+38-43
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class DummyCoreClient(BaseCoreClient):
2222
def all_collections(self, *args, **kwargs):
23-
raise NotImplementedError
23+
return {"collections": [], "links": []}
2424

2525
def get_collection(self, *args, **kwargs):
2626
raise NotImplementedError
@@ -38,48 +38,6 @@ def item_collection(self, *args, **kwargs):
3838
raise NotImplementedError
3939

4040

41-
def test_get_aggregations(client: TestClient) -> None:
42-
response = client.get("/aggregations")
43-
assert response.is_success, response.text
44-
assert response.json()["aggregations"] == [
45-
{"name": "total_count", "data_type": "integer"}
46-
]
47-
assert AggregationCollection(
48-
type="AggregationCollection",
49-
aggregations=[Aggregation(**response.json()["aggregations"][0])],
50-
)
51-
52-
53-
def test_get_aggregate(client: TestClient) -> None:
54-
response = client.get("/aggregate")
55-
assert response.is_success, response.text
56-
assert response.json()["aggregations"] == []
57-
assert AggregationCollection(
58-
type="AggregationCollection", aggregations=response.json()["aggregations"]
59-
)
60-
61-
62-
def test_post_aggregations(client: TestClient) -> None:
63-
response = client.post("/aggregations")
64-
assert response.is_success, response.text
65-
assert response.json()["aggregations"] == [
66-
{"name": "total_count", "data_type": "integer"}
67-
]
68-
assert AggregationCollection(
69-
type="AggregationCollection",
70-
aggregations=[Aggregation(**response.json()["aggregations"][0])],
71-
)
72-
73-
74-
def test_post_aggregate(client: TestClient) -> None:
75-
response = client.post("/aggregate", content="{}")
76-
assert response.is_success, response.text
77-
assert response.json()["aggregations"] == []
78-
assert AggregationCollection(
79-
type="AggregationCollection", aggregations=response.json()["aggregations"]
80-
)
81-
82-
8341
@pytest.fixture
8442
def client(
8543
core_client: DummyCoreClient, aggregations_client: BaseAggregationClient
@@ -132,3 +90,40 @@ def test(query=Depends(AggregationExtensionGetRequest)):
13290
params = response.json()
13391
assert params["collections"] == ["collection1", "collection2"]
13492
assert params["aggregations"] == ["prop1", "prop2"]
93+
94+
95+
def test_landing(client: TestClient) -> None:
96+
landing = client.get("/")
97+
assert landing.status_code == 200, landing.text
98+
assert "Aggregate" in [link.get("title") for link in landing.json()["links"]]
99+
assert "Aggregations" in [link.get("title") for link in landing.json()["links"]]
100+
101+
102+
def test_get_aggregate(client: TestClient) -> None:
103+
response = client.get("/aggregate")
104+
assert response.is_success, response.text
105+
assert response.json()["aggregations"] == []
106+
assert AggregationCollection(
107+
type="AggregationCollection", aggregations=response.json()["aggregations"]
108+
)
109+
110+
111+
def test_post_aggregations(client: TestClient) -> None:
112+
response = client.post("/aggregations")
113+
assert response.is_success, response.text
114+
assert response.json()["aggregations"] == [
115+
{"name": "total_count", "data_type": "integer"}
116+
]
117+
assert AggregationCollection(
118+
type="AggregationCollection",
119+
aggregations=[Aggregation(**response.json()["aggregations"][0])],
120+
)
121+
122+
123+
def test_post_aggregate(client: TestClient) -> None:
124+
response = client.post("/aggregate", content="{}")
125+
assert response.is_success, response.text
126+
assert response.json()["aggregations"] == []
127+
assert AggregationCollection(
128+
type="AggregationCollection", aggregations=response.json()["aggregations"]
129+
)

stac_fastapi/types/stac_fastapi/types/core.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
384384
)
385385

386386
# Add Queryables link
387-
if self.extension_is_enabled("FilterExtension"):
387+
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
388+
"SearchFilterExtension"
389+
):
388390
landing_page["links"].append(
389391
{
390392
"rel": Relations.queryables.value,
@@ -605,7 +607,9 @@ async def landing_page(self, **kwargs) -> stac.LandingPage:
605607
)
606608

607609
# Add Queryables link
608-
if self.extension_is_enabled("FilterExtension"):
610+
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
611+
"SearchFilterExtension"
612+
):
609613
landing_page["links"].append(
610614
{
611615
"rel": Relations.queryables.value,
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library version."""
22

3-
__version__ = "5.0.0"
3+
__version__ = "5.0.1"

0 commit comments

Comments
 (0)