Skip to content

Commit

Permalink
Adding queryables link to landing page (#587)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Apr 10, 2024
1 parent 8169e86 commit a262115
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

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

### Changed

Expand Down
26 changes: 26 additions & 0 deletions stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,18 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
extension_schemas=[],
)

# Add Queryables link
if self.extension_is_enabled("FilterExtension"):
landing_page["links"].append(
{
"rel": Relations.queryables.value,
"type": MimeTypes.jsonschema,
"title": "Queryables",
"href": urljoin(base_url, "queryables"),
"method": "GET",
}
)

# Add Collections links
collections = self.all_collections(request=kwargs["request"])
for collection in collections["collections"]:
Expand Down Expand Up @@ -566,6 +578,20 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage:
conformance_classes=self.conformance_classes(),
extension_schemas=[],
)

# Add Queryables link
if self.extension_is_enabled("FilterExtension"):
landing_page["links"].append(
{
"rel": Relations.queryables.value,
"type": MimeTypes.jsonschema,
"title": "Queryables",
"href": urljoin(base_url, "queryables"),
"method": "GET",
}
)

# Add Collections links
collections = await self.all_collections(request=kwargs["request"])
for collection in collections["collections"]:
landing_page["links"].append(
Expand Down

0 comments on commit a262115

Please sign in to comment.