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

Release/v5.0.1 #795

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
9 changes: 8 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [5.0.1] - 2025-01-30

### Fixed

- add `Queryables` links when `SearchFilterExtension` is enabled

## [5.0.0] - 2025-01-30

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

* First PyPi release!

[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.0..main>
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.1..main>
[5.0.1]: <https://github.com/stac-utils/stac-fastapi/compare/5.0.0..5.0.1>
[5.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/4.0.1..5.0.0>
[4.0.1]: <https://github.com/stac-utils/stac-fastapi/compare/4.0.0..4.0.1>
[4.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.5..4.0.0>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.0.1
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.0"
current_version = "5.0.1"
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.0"
__version__ = "5.0.1"
40 changes: 39 additions & 1 deletion stac_fastapi/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
create_get_request_model,
create_post_request_model,
)
from stac_fastapi.extensions.core import FieldsExtension, FilterExtension
from stac_fastapi.extensions.core import (
FieldsExtension,
FilterExtension,
SearchFilterExtension,
)
from stac_fastapi.types import stac
from stac_fastapi.types.config import ApiSettings
from stac_fastapi.types.core import BaseCoreClient, NumType
Expand Down Expand Up @@ -184,6 +188,40 @@ def get_search(
)

assert landing.status_code == 200, landing.text
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
assert get_search.status_code == 200, get_search.text
assert post_search.status_code == 200, post_search.text

test_app = app.StacApi(
settings=ApiSettings(enable_response_models=validate),
client=FilterClient(),
search_get_request_model=create_get_request_model([SearchFilterExtension()]),
search_post_request_model=create_post_request_model([SearchFilterExtension()]),
extensions=[SearchFilterExtension()],
)

with TestClient(test_app.app) as client:
landing = client.get("/")
get_search = client.get(
"/search",
params={
"filter": "TEST",
"filter-crs": "EPSG:4326",
"filter-lang": "cql2-text",
},
)
post_search = client.post(
"/search",
json={
"collections": ["test"],
"filter": {},
"filter-crs": "EPSG:4326",
"filter-lang": "cql2-json",
},
)

assert landing.status_code == 200, landing.text
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
assert get_search.status_code == 200, get_search.text
assert post_search.status_code == 200, post_search.text

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.0"
__version__ = "5.0.1"
81 changes: 38 additions & 43 deletions stac_fastapi/extensions/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class DummyCoreClient(BaseCoreClient):
def all_collections(self, *args, **kwargs):
raise NotImplementedError
return {"collections": [], "links": []}

def get_collection(self, *args, **kwargs):
raise NotImplementedError
Expand All @@ -38,48 +38,6 @@ def item_collection(self, *args, **kwargs):
raise NotImplementedError


def test_get_aggregations(client: TestClient) -> None:
response = client.get("/aggregations")
assert response.is_success, response.text
assert response.json()["aggregations"] == [
{"name": "total_count", "data_type": "integer"}
]
assert AggregationCollection(
type="AggregationCollection",
aggregations=[Aggregation(**response.json()["aggregations"][0])],
)


def test_get_aggregate(client: TestClient) -> None:
response = client.get("/aggregate")
assert response.is_success, response.text
assert response.json()["aggregations"] == []
assert AggregationCollection(
type="AggregationCollection", aggregations=response.json()["aggregations"]
)


def test_post_aggregations(client: TestClient) -> None:
response = client.post("/aggregations")
assert response.is_success, response.text
assert response.json()["aggregations"] == [
{"name": "total_count", "data_type": "integer"}
]
assert AggregationCollection(
type="AggregationCollection",
aggregations=[Aggregation(**response.json()["aggregations"][0])],
)


def test_post_aggregate(client: TestClient) -> None:
response = client.post("/aggregate", content="{}")
assert response.is_success, response.text
assert response.json()["aggregations"] == []
assert AggregationCollection(
type="AggregationCollection", aggregations=response.json()["aggregations"]
)


@pytest.fixture
def client(
core_client: DummyCoreClient, aggregations_client: BaseAggregationClient
Expand Down Expand Up @@ -132,3 +90,40 @@ def test(query=Depends(AggregationExtensionGetRequest)):
params = response.json()
assert params["collections"] == ["collection1", "collection2"]
assert params["aggregations"] == ["prop1", "prop2"]


def test_landing(client: TestClient) -> None:
landing = client.get("/")
assert landing.status_code == 200, landing.text
assert "Aggregate" in [link.get("title") for link in landing.json()["links"]]
assert "Aggregations" in [link.get("title") for link in landing.json()["links"]]


def test_get_aggregate(client: TestClient) -> None:
response = client.get("/aggregate")
assert response.is_success, response.text
assert response.json()["aggregations"] == []
assert AggregationCollection(
type="AggregationCollection", aggregations=response.json()["aggregations"]
)


def test_post_aggregations(client: TestClient) -> None:
response = client.post("/aggregations")
assert response.is_success, response.text
assert response.json()["aggregations"] == [
{"name": "total_count", "data_type": "integer"}
]
assert AggregationCollection(
type="AggregationCollection",
aggregations=[Aggregation(**response.json()["aggregations"][0])],
)


def test_post_aggregate(client: TestClient) -> None:
response = client.post("/aggregate", content="{}")
assert response.is_success, response.text
assert response.json()["aggregations"] == []
assert AggregationCollection(
type="AggregationCollection", aggregations=response.json()["aggregations"]
)
8 changes: 6 additions & 2 deletions stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
)

# Add Queryables link
if self.extension_is_enabled("FilterExtension"):
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
"SearchFilterExtension"
):
landing_page["links"].append(
{
"rel": Relations.queryables.value,
Expand Down Expand Up @@ -605,7 +607,9 @@ async def landing_page(self, **kwargs) -> stac.LandingPage:
)

# Add Queryables link
if self.extension_is_enabled("FilterExtension"):
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
"SearchFilterExtension"
):
landing_page["links"].append(
{
"rel": Relations.queryables.value,
Expand Down
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.0"
__version__ = "5.0.1"