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

Feature/update stac pydantic3.1.0 #697

Merged
merged 6 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions stac_fastapi/api/stac_fastapi/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions stac_fastapi/api/tests/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
collections = [
stac_types.Collection(
id=f"test_collection_{n}",
type="Collection",
title="Test Collection",
description="A test collection",
keywords=["test"],
Expand All @@ -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)
]
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions stac_fastapi/api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@pytest.fixture
def _collection():
return Collection(
type="Collection",
id="test_collection",
title="Test Collection",
description="A test collection",
Expand Down
2 changes: 1 addition & 1 deletion stac_fastapi/types/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
12 changes: 4 additions & 8 deletions stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions stac_fastapi/types/stac_fastapi/types/rfc3339.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I think this wasn't really what was need 😓
I think #692 does it better


vincentsarago marked this conversation as resolved.
Show resolved Hide resolved
try:
start = parse_single_date(values[0]) if values[0] not in ["..", ""] else None
end = (
Expand Down