Skip to content

Commit

Permalink
Fix #259 (stac_validator error NULL in title element (#260)
Browse files Browse the repository at this point in the history
* * Modified BaseCoreClient::landing_page to add the collection.get('id') in case title is NULL.
  This fixes issue 259 where stac_validator would mark having a NULL in the title element.

* * Modified the test as per stac_validator, NULL strings as titles is against spec.

* Update CHANGES.md

Co-authored-by: Jeff Albrecht <geospatialjeff@gmail.com>
Co-authored-by: Jeff Albrecht <jeff@arturo.ai>
  • Loading branch information
3 people authored Sep 13, 2021
1 parent c9654af commit 069f0b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Pin FastAPI to 0.67 to avoid issues with rendering OpenAPI documentation ([#246](https://github.com/stac-utils/stac-fastapi/pull/246))
* Restrict `limit` parameter in sqlalchemy backend to between 1 and 10,000. ([#251](https://github.com/stac-utils/stac-fastapi/pull/251))
* Fix OAS conformance URL ([#263](https://github.com/stac-utils/stac-fastapi/pull/263))
* Links to children collections from the landing pagge always have a title ([#260](https://github.com/stac-utils/stac-fastapi/pull/260))

## [2.1.0]

Expand Down Expand Up @@ -70,4 +71,4 @@ _2020-09-25_
[2.1.0]: <https://github.com/stac-utils/stac-fastapi/compare/2.1.0..main>
[2.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/1.1.0..2.0.0>
[1.1.0]: <https://github.com/stac-utils/stac-fastapi/compare/1.0.0..1.1.0>
[1.0.0]: <https://github.com/stac-utils/stac-fastapi/tree/1.0.0>
[1.0.0]: <https://github.com/stac-utils/stac-fastapi/tree/1.0.0>
2 changes: 1 addition & 1 deletion stac_fastapi/sqlalchemy/tests/clients/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,4 @@ class MockStarletteRequestWithApp(MockStarletteRequest):
landing_page = postgres_core.landing_page(request=MockStarletteRequestWithApp)
for link in landing_page["links"]:
if link["href"].split("/")[-1] == coll["id"]:
assert not link["title"]
assert link["title"]
2 changes: 1 addition & 1 deletion stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
{
"rel": Relations.child.value,
"type": MimeTypes.json.value,
"title": collection.get("title"),
"title": collection.get("title") or collection.get("id"),
"href": urljoin(base_url, f"collections/{collection['id']}"),
}
)
Expand Down

0 comments on commit 069f0b1

Please sign in to comment.