Skip to content

Commit a262115

Browse files
constantiniusgadomskivincentsarago
authored
Adding queryables link to landing page (#587)
* Adding queryables link to landing page * Adding info to changelog * Fixing schemajson -> jsonschema * use `extension_is_enabled` --------- Co-authored-by: Pete Gadomski <[email protected]> Co-authored-by: Vincent Sarago <[email protected]>
1 parent 8169e86 commit a262115

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
* Add benchmark in CI ([#650](https://github.com/stac-utils/stac-fastapi/pull/650))
8+
* Add `/queryables` link to the landing page ([#587](https://github.com/stac-utils/stac-fastapi/pull/587))
89

910
### Changed
1011

stac_fastapi/types/stac_fastapi/types/core.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
369369
extension_schemas=[],
370370
)
371371

372+
# Add Queryables link
373+
if self.extension_is_enabled("FilterExtension"):
374+
landing_page["links"].append(
375+
{
376+
"rel": Relations.queryables.value,
377+
"type": MimeTypes.jsonschema,
378+
"title": "Queryables",
379+
"href": urljoin(base_url, "queryables"),
380+
"method": "GET",
381+
}
382+
)
383+
372384
# Add Collections links
373385
collections = self.all_collections(request=kwargs["request"])
374386
for collection in collections["collections"]:
@@ -566,6 +578,20 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage:
566578
conformance_classes=self.conformance_classes(),
567579
extension_schemas=[],
568580
)
581+
582+
# Add Queryables link
583+
if self.extension_is_enabled("FilterExtension"):
584+
landing_page["links"].append(
585+
{
586+
"rel": Relations.queryables.value,
587+
"type": MimeTypes.jsonschema,
588+
"title": "Queryables",
589+
"href": urljoin(base_url, "queryables"),
590+
"method": "GET",
591+
}
592+
)
593+
594+
# Add Collections links
569595
collections = await self.all_collections(request=kwargs["request"])
570596
for collection in collections["collections"]:
571597
landing_page["links"].append(

0 commit comments

Comments
 (0)