From 2f3c3942a561d03498ba5b666338cb280c53764d Mon Sep 17 00:00:00 2001 From: rhysrevans3 Date: Fri, 6 Sep 2024 13:36:45 +0100 Subject: [PATCH 1/2] Updating collection self link for collections page. --- stac_fastapi/core/stac_fastapi/core/models/links.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stac_fastapi/core/stac_fastapi/core/models/links.py b/stac_fastapi/core/stac_fastapi/core/models/links.py index f12ad98f..76f0ce5b 100644 --- a/stac_fastapi/core/stac_fastapi/core/models/links.py +++ b/stac_fastapi/core/stac_fastapi/core/models/links.py @@ -114,6 +114,14 @@ class CollectionLinks(BaseLinks): collection_id: str = attr.ib() extensions: List[str] = attr.ib(default=attr.Factory(list)) + def link_self(self) -> Dict: + """Return the self link.""" + return dict( + rel=Relations.self.value, + type=MimeTypes.json.value, + href=urljoin(self.base_url, f"collections/{self.collection_id}"), + ) + def link_parent(self) -> Dict[str, Any]: """Create the `parent` link.""" return dict(rel=Relations.parent, type=MimeTypes.json.value, href=self.base_url) From 7c08f735485d8baa439443685851053fce0f654b Mon Sep 17 00:00:00 2001 From: rhysrevans3 Date: Fri, 6 Sep 2024 13:44:53 +0100 Subject: [PATCH 2/2] Adding to CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c30ffaa..2af1f970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed +- Updated CollectionLinks to generate correct self link for collections endpoint. [#297](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/297) + ## [v3.1.0] - 2024-09-02 ### Added