File tree Expand file tree Collapse file tree 5 files changed +29
-6
lines changed
extensions/stac_fastapi/extensions/core/filter Expand file tree Collapse file tree 5 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 38
38
* Transactions Extension update Item endpoint validates that the ` {collection_id} ` path parameter matches the Item ` "collection" ` property
39
39
from the request body, if present, and falls back to using the path parameter if no ` "collection" ` property is found in the body
40
40
([ #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 ) )
41
42
42
43
## [ 2.3.0]
43
44
Original file line number Diff line number Diff line change @@ -160,10 +160,20 @@ class GeoJSONResponse(ORJSONResponse):
160
160
161
161
media_type = "application/geo+json"
162
162
163
+ class JSONSchemaResponse (ORJSONResponse ):
164
+ """JSON with custom, vendor content-type."""
165
+
166
+ media_type = "application/schema+json"
167
+
163
168
else :
164
169
from starlette .responses import JSONResponse
165
170
166
171
class GeoJSONResponse (JSONResponse ):
167
172
"""JSON with custom, vendor content-type."""
168
173
169
174
media_type = "application/geo+json"
175
+
176
+ class JSONSchemaResponse (JSONResponse ):
177
+ """JSON with custom, vendor content-type."""
178
+
179
+ media_type = "application/schema+json"
Original file line number Diff line number Diff line change 5
5
6
6
import attr
7
7
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
+ )
11
16
from stac_fastapi .api .routes import create_async_endpoint , create_sync_endpoint
12
17
from stac_fastapi .types .core import AsyncBaseFiltersClient , BaseFiltersClient
13
18
from stac_fastapi .types .extension import ApiExtension
@@ -71,7 +76,7 @@ class FilterExtension(ApiExtension):
71
76
]
72
77
)
73
78
router : APIRouter = attr .ib (factory = APIRouter )
74
- response_class : Type [Response ] = attr .ib (default = JSONResponse )
79
+ response_class : Type [Response ] = attr .ib (default = JSONSchemaResponse )
75
80
76
81
def _create_endpoint (
77
82
self ,
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ async def test_get_search_content_type(app_client):
32
32
assert resp .headers ["content-type" ] == "application/geo+json"
33
33
34
34
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
+
35
44
async def test_api_headers (app_client ):
36
45
resp = await app_client .get ("/api" )
37
46
assert (
Original file line number Diff line number Diff line change @@ -353,8 +353,6 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
353
353
extension_schemas = [
354
354
schema .schema_href for schema in self .extensions if schema .schema_href
355
355
]
356
- request : Request = kwargs ["request" ]
357
- base_url = str (request .base_url )
358
356
landing_page = self ._landing_page (
359
357
base_url = base_url ,
360
358
conformance_classes = self .conformance_classes (),
You can’t perform that action at this time.
0 commit comments