diff --git a/CHANGES.md b/CHANGES.md index e5de2e54..ee8ce843 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Add `/queryables` link to the collections ([#49](https://github.com/stac-utils/stac-fastapi-pgstac/pull/49)) + ## [2.4.9] - 2023-06-21 ### Fixed diff --git a/stac_fastapi/pgstac/models/links.py b/stac_fastapi/pgstac/models/links.py index 8ba435d4..2da66df3 100644 --- a/stac_fastapi/pgstac/models/links.py +++ b/stac_fastapi/pgstac/models/links.py @@ -11,7 +11,7 @@ # These can be inferred from the item/collection so they aren't included in the database # Instead they are dynamically generated when querying the database using the classes defined below -INFERRED_LINK_RELS = ["self", "item", "parent", "collection", "root"] +INFERRED_LINK_RELS = ["self", "item", "parent", "collection", "root", Relations.queryables.value] def filter_links(links: List[Dict]) -> List[Dict]: @@ -204,6 +204,14 @@ def link_items(self) -> Dict: href=self.resolve(f"collections/{self.collection_id}/items"), ) + def link_queryables(self) -> Dict: + """Create the `queryables` link.""" + return dict( + rel=Relations.queryables.value, + type=MimeTypes.jsonschema.value, + href=self.resolve(f"collections/{self.collection_id}/queryables"), + ) + @attr.s class ItemCollectionLinks(CollectionLinksBase):