Repository: stac-utils/stac-fastapi
Pull request #805 (2025-03-03 16:49:46)

Patch/add titles in links
```
curl http://127.0.0.1:8081  | jq '.links[]'
{
  "rel": "self",
  "type": "application/json",
  "title": "This document",
  "href": "http://127.0.0.1:8081/"
}
{
  "rel": "root",
  "type": "application/json",
  "title": "Root",
  "href": "http://127.0.0.1:8081/"
}
{
  "rel": "data",
  "type": "application/json",
  "title": "Collections available for this Catalog",
  "href": "http://127.0.0.1:8081/collections"
}
{
  "rel": "conformance",
  "type": "application/json",
  "title": "STAC/OGC conformance classes implemented by this server",
  "href": "http://127.0.0.1:8081/conformance"
}
{
  "rel": "search",
  "type": "application/geo+json",
  "title": "STAC search [GET]",
  "href": "http://127.0.0.1:8081/search",
  "method": "GET"
}
{
  "rel": "search",
  "type": "application/geo+json",
  "title": "STAC search [POST]",
  "href": "http://127.0.0.1:8081/search",
  "method": "POST"
}
{
  "rel": "http://www.opengis.net/def/rel/ogc/1.0/queryables",
  "type": "application/schema+json",
  "title": "Queryables available for this Catalog",
  "href": "http://127.0.0.1:8081/queryables"
}
{
  "rel": "service-desc",
  "type": "application/vnd.oai.openapi+json;version=3.0",
  "title": "OpenAPI service description",
  "href": "http://127.0.0.1:8081/api"
}
{
  "rel": "service-doc",
  "type": "text/html",
  "title": "OpenAPI service documentation",
  "href": "http://127.0.0.1:8081/api.html"
}
```


Patch:
diff --git a/CHANGES.md b/CHANGES.md
index 732d591..ba0307b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,10 @@
 
 ## [Unreleased]
 
+### Added
+
+- titles in `Landing` page links
+
 ### Changed
 
 - remove `child` links (`collections`) in landing page response
diff --git a/stac_fastapi/types/stac_fastapi/types/core.py b/stac_fastapi/types/stac_fastapi/types/core.py
index 4796f58..99ef87f 100644
--- a/stac_fastapi/types/stac_fastapi/types/core.py
+++ b/stac_fastapi/types/stac_fastapi/types/core.py
@@ -289,16 +289,19 @@ class LandingPageMixin(abc.ABC):
                 {
                     "rel": Relations.self.value,
                     "type": MimeTypes.json.value,
+                    "title": "This document",
                     "href": base_url,
                 },
                 {
                     "rel": Relations.root.value,
                     "type": MimeTypes.json.value,
+                    "title": "Root",
                     "href": base_url,
                 },
                 {
                     "rel": Relations.data.value,
                     "type": MimeTypes.json.value,
+                    "title": "Collections available for this Catalog",
                     "href": urljoin(base_url, "collections"),
                 },
                 {
@@ -310,14 +313,14 @@ class LandingPageMixin(abc.ABC):
                 {
                     "rel": Relations.search.value,
                     "type": MimeTypes.geojson.value,
-                    "title": "STAC search",
+                    "title": "STAC search [GET]",
                     "href": urljoin(base_url, "search"),
                     "method": "GET",
                 },
                 {
                     "rel": Relations.search.value,
                     "type": MimeTypes.geojson.value,
-                    "title": "STAC search",
+                    "title": "STAC search [POST]",
                     "href": urljoin(base_url, "search"),
                     "method": "POST",
                 },
@@ -391,7 +394,7 @@ class BaseCoreClient(LandingPageMixin, abc.ABC):
                 {
                     "rel": Relations.queryables.value,
                     "type": MimeTypes.jsonschema.value,
-                    "title": "Queryables",
+                    "title": "Queryables available for this Catalog",
                     "href": urljoin(base_url, "queryables"),
                 }
             )
@@ -601,7 +604,7 @@ class AsyncBaseCoreClient(LandingPageMixin, abc.ABC):
                 {
                     "rel": Relations.queryables.value,
                     "type": MimeTypes.jsonschema.value,
-                    "title": "Queryables",
+                    "title": "Queryables available for this Catalog",
                     "href": urljoin(base_url, "queryables"),
                     "method": "GET",
                 }


Test patch:
diff --git a/stac_fastapi/api/tests/test_app.py b/stac_fastapi/api/tests/test_app.py
index 417d12f..7c77a9a 100644
--- a/stac_fastapi/api/tests/test_app.py
+++ b/stac_fastapi/api/tests/test_app.py
@@ -188,7 +188,9 @@ def test_filter_extension(validate, TestCoreClient, item_dict):
         )
 
     assert landing.status_code == 200, landing.text
-    assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
+    assert "Queryables available for this Catalog" in [
+        link.get("title") for link in landing.json()["links"]
+    ]
     assert get_search.status_code == 200, get_search.text
     assert post_search.status_code == 200, post_search.text
 
@@ -221,7 +223,9 @@ def test_filter_extension(validate, TestCoreClient, item_dict):
         )
 
     assert landing.status_code == 200, landing.text
-    assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
+    assert "Queryables available for this Catalog" in [
+        link.get("title") for link in landing.json()["links"]
+    ]
     assert get_search.status_code == 200, get_search.text
     assert post_search.status_code == 200, post_search.text
 
diff --git a/stac_fastapi/api/tests/test_app_prefix.py b/stac_fastapi/api/tests/test_app_prefix.py
index 196e461..ea20c6c 100644
--- a/stac_fastapi/api/tests/test_app_prefix.py
+++ b/stac_fastapi/api/tests/test_app_prefix.py
@@ -64,6 +64,7 @@ def test_api_prefix(TestCoreClient, prefix):
 
         link_tests = [
             ("root", "application/json", "/"),
+            ("self", "application/json", "/"),
             ("conformance", "application/json", "/conformance"),
             ("data", "application/json", "/collections"),
             ("search", "application/geo+json", "/search"),
@@ -126,6 +127,7 @@ def test_async_api_prefix(AsyncTestCoreClient, prefix):
 
         link_tests = [
             ("root", "application/json", "/"),
+            ("self", "application/json", "/"),
             ("conformance", "application/json", "/conformance"),
             ("data", "application/json", "/collections"),
             ("search", "application/geo+json", "/search"),
@@ -190,6 +192,7 @@ def test_api_prefix_with_root_path(TestCoreClient, prefix):
 
         link_tests = [
             ("root", "application/json", "/"),
+            ("self", "application/json", "/"),
             ("conformance", "application/json", "/conformance"),
             ("data", "application/json", "/collections"),
             ("search", "application/geo+json", "/search"),