Skip to content

Commit 3321c7b

Browse files
authored
Merge branch 'master' into master
2 parents 3ea9232 + 9ee7cb1 commit 3321c7b

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

CHANGES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
### Added
66

77
* Add support in pgstac backend for /queryables and /collections/{collection_id}/queryables endpoints with functions exposed in pgstac 0.6.8
8-
* Update pgstac requirement to 0.6.8
98
* Add `bbox` and `datetime` query parameters to `/collections/{collection_id}/items`. [476](https://github.com/stac-utils/stac-fastapi/issues/476) [380](https://github.com/stac-utils/stac-fastapi/issues/380)
9+
* Update pgstac requirement to 0.6.10
1010

1111
### Changed
1212

1313
### Removed
1414

1515
### Fixed
1616

17+
* Fix pgstac backend for /queryables endpoint to return 404 for non-existent collections [#482](https://github.com/stac-utils/stac-fastapi/pull/482)
18+
19+
1720
## [2.4.2]
1821

1922
### Added

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ services:
6363

6464
database:
6565
container_name: stac-db
66-
image: ghcr.io/stac-utils/pgstac:v0.6.8
66+
image: ghcr.io/stac-utils/pgstac:v0.6.10
6767
environment:
6868
- POSTGRES_USER=username
6969
- POSTGRES_PASSWORD=password

stac_fastapi/pgstac/stac_fastapi/pgstac/extensions/filter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from fastapi.responses import JSONResponse
77

88
from stac_fastapi.types.core import AsyncBaseFiltersClient
9+
from stac_fastapi.types.errors import NotFoundError
910

1011

1112
class FiltersClient(AsyncBaseFiltersClient):
@@ -32,6 +33,9 @@ async def get_queryables(
3233
collection=collection_id,
3334
)
3435
queryables = await conn.fetchval(q, *p)
36+
if not queryables:
37+
raise NotFoundError(f"Collection {collection_id} not found")
38+
3539
queryables["$id"] = str(request.url)
3640
headers = {"Content-Type": "application/schema+json"}
3741
return JSONResponse(queryables, headers=headers)

stac_fastapi/pgstac/tests/api/test_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,10 @@ async def test_item_collection_filter_datetime(
463463
assert resp.status_code == 200
464464
resp_json = resp.json()
465465
assert len(resp_json["features"]) == 0
466+
467+
@pytest.mark.asyncio
468+
async def test_bad_collection_queryables(
469+
load_test_data, app_client, load_test_collection
470+
):
471+
resp = await app_client.get("/collections/bad-collection/queryables")
472+
assert resp.status_code == 404

0 commit comments

Comments
 (0)