Skip to content

Commit c14529c

Browse files
committed
queryables, updated:
"$schema" to the one from pgstac (seems newer and more advanced) "$id" made it dynamic
1 parent defafc5 commit c14529c

File tree

1 file changed

+8
-8
lines changed
  • stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/filter

1 file changed

+8
-8
lines changed

stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/filter/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any, Dict, Optional, Tuple
55

66
import attr
7+
from fastapi import Request
78

89
from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
910
from stac_fastapi.core.extensions.filter import ALL_QUERYABLES, DEFAULT_QUERYABLES
@@ -20,6 +21,7 @@ class EsAsyncBaseFiltersClient(AsyncBaseFiltersClient):
2021
async def get_queryables(
2122
self, collection_id: Optional[str] = None, **kwargs
2223
) -> Dict[str, Any]:
24+
request: Optional[Request] = kwargs.get("request").url
2325
"""Get the queryables available for the given collection_id.
2426
2527
If collection_id is None, returns the intersection of all
@@ -38,8 +40,8 @@ async def get_queryables(
3840
Dict[str, Any]: A dictionary containing the queryables for the given collection.
3941
"""
4042
queryables: Dict[str, Any] = {
41-
"$schema": "https://json-schema.org/draft/2019-09/schema",
42-
"$id": "https://stac-api.example.com/queryables",
43+
"$schema": "https://json-schema.org/draft-07/schema#",
44+
"$id": f"{request!s}",
4345
"type": "object",
4446
"title": "Queryables for STAC API",
4547
"description": "Queryable names for the STAC API Item Search filter.",
@@ -50,12 +52,10 @@ async def get_queryables(
5052
return queryables
5153

5254
properties: Dict[str, Any] = queryables["properties"].copy()
53-
queryables.update(
54-
{
55-
"properties": properties,
56-
"additionalProperties": False,
57-
}
58-
)
55+
queryables.update({
56+
"properties": properties,
57+
"additionalProperties": False,
58+
})
5959

6060
mapping_data = await self.database.get_items_mapping(collection_id)
6161
mapping_properties = next(iter(mapping_data.values()))["mappings"]["properties"]

0 commit comments

Comments
 (0)