Skip to content

Commit 8529d07

Browse files
authored
Merge branch 'master' into change/406-create-item-collection-id
2 parents a35f41e + 1faabd3 commit 8529d07

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* Transactions Extension update Item endpoint validates that the `{collection_id}` path parameter matches the Item `"collection"` property
3939
from the request body, if present, and falls back to using the path parameter if no `"collection"` property is found in the body
4040
([#425](https://github.com/stac-utils/stac-fastapi/pull/425))
41+
* `/queryables` endpoint now has type `application/schema+json` instead of `application/json` ([#421](https://github.com/stac-utils/stac-fastapi/pull/421))
4142

4243
## [2.3.0]
4344

stac_fastapi/api/stac_fastapi/api/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,20 @@ class GeoJSONResponse(ORJSONResponse):
160160

161161
media_type = "application/geo+json"
162162

163+
class JSONSchemaResponse(ORJSONResponse):
164+
"""JSON with custom, vendor content-type."""
165+
166+
media_type = "application/schema+json"
167+
163168
else:
164169
from starlette.responses import JSONResponse
165170

166171
class GeoJSONResponse(JSONResponse):
167172
"""JSON with custom, vendor content-type."""
168173

169174
media_type = "application/geo+json"
175+
176+
class JSONSchemaResponse(JSONResponse):
177+
"""JSON with custom, vendor content-type."""
178+
179+
media_type = "application/schema+json"

stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55

66
import attr
77
from fastapi import APIRouter, FastAPI
8-
from starlette.responses import JSONResponse, Response
9-
10-
from stac_fastapi.api.models import APIRequest, CollectionUri, EmptyRequest
8+
from starlette.responses import Response
9+
10+
from stac_fastapi.api.models import (
11+
APIRequest,
12+
CollectionUri,
13+
EmptyRequest,
14+
JSONSchemaResponse,
15+
)
1116
from stac_fastapi.api.routes import create_async_endpoint, create_sync_endpoint
1217
from stac_fastapi.types.core import AsyncBaseFiltersClient, BaseFiltersClient
1318
from stac_fastapi.types.extension import ApiExtension
@@ -71,7 +76,7 @@ class FilterExtension(ApiExtension):
7176
]
7277
)
7378
router: APIRouter = attr.ib(factory=APIRouter)
74-
response_class: Type[Response] = attr.ib(default=JSONResponse)
79+
response_class: Type[Response] = attr.ib(default=JSONSchemaResponse)
7580

7681
def _create_endpoint(
7782
self,

stac_fastapi/pgstac/tests/api/test_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ async def test_get_search_content_type(app_client):
3232
assert resp.headers["content-type"] == "application/geo+json"
3333

3434

35+
async def test_get_queryables_content_type(app_client, load_test_collection):
36+
resp = await app_client.get("queryables")
37+
assert resp.headers["content-type"] == "application/schema+json"
38+
39+
coll = load_test_collection
40+
resp = await app_client.get(f"collections/{coll.id}/queryables")
41+
assert resp.headers["content-type"] == "application/schema+json"
42+
43+
3544
async def test_api_headers(app_client):
3645
resp = await app_client.get("/api")
3746
assert (

stac_fastapi/types/stac_fastapi/types/core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
353353
extension_schemas = [
354354
schema.schema_href for schema in self.extensions if schema.schema_href
355355
]
356-
request: Request = kwargs["request"]
357-
base_url = str(request.base_url)
358356
landing_page = self._landing_page(
359357
base_url=base_url,
360358
conformance_classes=self.conformance_classes(),

0 commit comments

Comments
 (0)