diff --git a/CHANGES.md b/CHANGES.md index 940b7b84..abff6ce4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,8 +4,10 @@ ### Changed -* switch from `fastapi` to `fastapi-slim` to avoid installing unwanted dependencies. ([#687](https://github.com/stac-utils/stac-fastapi/pull/687)) -* replace Enum with `Literal` for `FilterLang`. ([#686](https://github.com/stac-utils/stac-fastapi/pull/686)) +* Switch from `fastapi` to `fastapi-slim` to avoid installing unwanted dependencies. ([#687](https://github.com/stac-utils/stac-fastapi/pull/687)) +* Replace Enum with `Literal` for `FilterLang`. ([#686](https://github.com/stac-utils/stac-fastapi/pull/686)) +* Update stac-pydantic requirement to `~3.1` ([#697](https://github.com/stac-utils/stac-fastapi/pull/697)) +* Fix datetime interval for GET Search when passing a single value ([#697](https://github.com/stac-utils/stac-fastapi/pull/697)) ### Removed diff --git a/stac_fastapi/api/stac_fastapi/api/app.py b/stac_fastapi/api/stac_fastapi/api/app.py index ed9a1cc7..7eb7c4e8 100644 --- a/stac_fastapi/api/stac_fastapi/api/app.py +++ b/stac_fastapi/api/stac_fastapi/api/app.py @@ -172,14 +172,14 @@ def register_conformance_classes(self): name="Conformance Classes", path="/conformance", response_model=( - api.ConformanceClasses if self.settings.enable_response_models else None + api.Conformance if self.settings.enable_response_models else None ), responses={ 200: { "content": { MimeTypes.json.value: {}, }, - "model": api.ConformanceClasses, + "model": api.Conformance, }, }, response_class=self.response_class, diff --git a/stac_fastapi/api/tests/benchmarks.py b/stac_fastapi/api/tests/benchmarks.py index 95e1c532..475250d7 100644 --- a/stac_fastapi/api/tests/benchmarks.py +++ b/stac_fastapi/api/tests/benchmarks.py @@ -17,6 +17,7 @@ collections = [ stac_types.Collection( id=f"test_collection_{n}", + type="Collection", title="Test Collection", description="A test collection", keywords=["test"], @@ -25,7 +26,7 @@ "spatial": {"bbox": [[-180, -90, 180, 90]]}, "temporal": {"interval": [["2000-01-01T00:00:00Z", None]]}, }, - links=collection_links.dict(exclude_none=True), + links=collection_links.model_dump(exclude_none=True), ) for n in range(0, 10) ] @@ -37,7 +38,7 @@ geometry={"type": "Point", "coordinates": [0, 0]}, bbox=[-180, -90, 180, 90], properties={"datetime": "2000-01-01T00:00:00Z"}, - links=item_links.dict(exclude_none=True), + links=item_links.model_dump(exclude_none=True), assets={}, ) for n in range(0, 1000) diff --git a/stac_fastapi/api/tests/conftest.py b/stac_fastapi/api/tests/conftest.py index 1b89f07c..33919e83 100644 --- a/stac_fastapi/api/tests/conftest.py +++ b/stac_fastapi/api/tests/conftest.py @@ -16,6 +16,7 @@ @pytest.fixture def _collection(): return Collection( + type="Collection", id="test_collection", title="Test Collection", description="A test collection", diff --git a/stac_fastapi/types/setup.py b/stac_fastapi/types/setup.py index 0dd166ec..c8f2f9df 100644 --- a/stac_fastapi/types/setup.py +++ b/stac_fastapi/types/setup.py @@ -9,7 +9,7 @@ "fastapi-slim", "attrs>=23.2.0", "pydantic-settings>=2", - "stac_pydantic>=3", + "stac_pydantic~=3.1", "iso8601>=1.0.2,<2.2.0", ] diff --git a/stac_fastapi/types/stac_fastapi/types/core.py b/stac_fastapi/types/stac_fastapi/types/core.py index fdf020b0..ba6ebe44 100644 --- a/stac_fastapi/types/stac_fastapi/types/core.py +++ b/stac_fastapi/types/stac_fastapi/types/core.py @@ -380,10 +380,8 @@ def landing_page(self, **kwargs) -> stac.LandingPage: if self.extension_is_enabled("FilterExtension"): landing_page["links"].append( { - # TODO: replace this with Relations.queryables.value, - "rel": "http://www.opengis.net/def/rel/ogc/1.0/queryables", - # TODO: replace this with MimeTypes.jsonschema, - "type": "application/schema+json", + "rel": Relations.queryables.value, + "type": MimeTypes.jsonschema.value, "title": "Queryables", "href": urljoin(base_url, "queryables"), "method": "GET", @@ -586,10 +584,8 @@ async def landing_page(self, **kwargs) -> stac.LandingPage: if self.extension_is_enabled("FilterExtension"): landing_page["links"].append( { - # TODO: replace this with Relations.queryables.value, - "rel": "http://www.opengis.net/def/rel/ogc/1.0/queryables", - # TODO: replace this with MimeTypes.jsonschema, - "type": "application/schema+json", + "rel": Relations.queryables.value, + "type": MimeTypes.jsonschema.value, "title": "Queryables", "href": urljoin(base_url, "queryables"), "method": "GET", diff --git a/stac_fastapi/types/stac_fastapi/types/rfc3339.py b/stac_fastapi/types/stac_fastapi/types/rfc3339.py index a551b45d..5ba0630a 100644 --- a/stac_fastapi/types/stac_fastapi/types/rfc3339.py +++ b/stac_fastapi/types/stac_fastapi/types/rfc3339.py @@ -122,6 +122,9 @@ def str_to_interval(interval: Optional[str]) -> Optional[DateTimeType]: detail="Interval string contains more than one forward slash.", ) + if len(values) == 1: + values = [values[0], values[0]] + try: start = parse_single_date(values[0]) if values[0] not in ["..", ""] else None end = (