Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stac-api-version in landing page response #763

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

* Add `numberMatched` and `numberReturned` properties in `types.stac.ItemCollection` model
* Add `numberMatched` and `numberReturned` properties in `types.stac.Collections` model
* add `stac_api_version` in Landing page response

## Changed

Expand Down
3 changes: 3 additions & 0 deletions stac_fastapi/api/stac_fastapi/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from fastapi.params import Depends
from stac_pydantic import api
from stac_pydantic.api.collections import Collections
from stac_pydantic.api.version import STAC_API_VERSION
from stac_pydantic.shared import MimeTypes
from stac_pydantic.version import STAC_VERSION
from starlette.middleware import Middleware
Expand Down Expand Up @@ -94,6 +95,7 @@ class StacApi:
)
)
stac_version: str = attr.ib(default=STAC_VERSION)
stac_api_version: str = attr.ib(default=STAC_API_VERSION)
description: str = attr.ib(
default=attr.Factory(
lambda self: self.settings.stac_fastapi_description, takes_self=True
Expand Down Expand Up @@ -442,6 +444,7 @@ def __attrs_post_init__(self):
# inject settings
self.client.extensions = self.extensions
self.client.stac_version = self.stac_version
self.client.stac_api_version = self.stac_api_version
self.client.title = self.title
self.client.description = self.description

Expand Down
3 changes: 3 additions & 0 deletions stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from fastapi import Request
from geojson_pydantic.geometries import Geometry
from stac_pydantic import Collection, Item, ItemCollection
from stac_pydantic.api.version import STAC_API_VERSION
from stac_pydantic.links import Relations
from stac_pydantic.shared import BBox, MimeTypes
from stac_pydantic.version import STAC_VERSION
Expand Down Expand Up @@ -269,6 +270,7 @@ class LandingPageMixin(abc.ABC):
"""Create a STAC landing page (GET /)."""

stac_version: str = attr.ib(default=STAC_VERSION)
stac_api_version: str = attr.ib(default=STAC_API_VERSION)
landing_page_id: str = attr.ib(default=api_settings.stac_fastapi_landing_id)
title: str = attr.ib(default=api_settings.stac_fastapi_title)
description: str = attr.ib(default=api_settings.stac_fastapi_description)
Expand All @@ -285,6 +287,7 @@ def _landing_page(
title=self.title,
description=self.description,
stac_version=self.stac_version,
stac_api_version=self.stac_api_version,
conformsTo=conformance_classes,
links=[
{
Expand Down
1 change: 1 addition & 0 deletions stac_fastapi/types/stac_fastapi/types/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Catalog(TypedDict, total=False):
class LandingPage(Catalog, total=False):
"""STAC Landing Page."""

stac_api_version: str
conformsTo: List[str]


Expand Down