Skip to content

Upgrade to stac-fastapi v2.5.5 #237

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

Merged
merged 5 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Added option to include Basic Auth [#232](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/232)

### Changed

- Upgrade stac-fastapi libaries to v2.5.5 [#237](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/237)

### Fixed

- Fixed `POST /collections/test-collection/items` returning an item with an empty links array [#236](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/236)
Expand Down
6 changes: 3 additions & 3 deletions stac_fastapi/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"attrs",
"pydantic[dotenv]<2",
"stac_pydantic==2.0.*",
"stac-fastapi.types==2.5.3",
"stac-fastapi.api==2.5.3",
"stac-fastapi.extensions==2.5.3",
"stac-fastapi.types==2.5.5.post1",
"stac-fastapi.api==2.5.5.post1",
"stac-fastapi.extensions==2.5.5.post1",
"pystac[validation]",
"orjson",
"overrides",
Expand Down
1 change: 1 addition & 0 deletions stac_fastapi/tests/resources/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def test_returns_valid_collection(ctx, app_client):
collection.validate()


@pytest.mark.skip(reason="Broken as of stac-fastapi v2.5.5")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this fine to skip? Or do we need a new test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did make an issue for this. I am not too sure about collection extensions and if people are using them. Ideally we would understand why this test started failing. If no one knows why it's failing, it should be fine to skip it for now and have it referenced as an issue I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a new test. It's working with adding a collection but not updating one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I went through this with the debugger and it seems like Pydantic is omitting the field when validating the request model (stac_fastapi.types.stac.Collection), only retaining the defined fields.
https://github.com/tiangolo/fastapi/blob/0.98.0/fastapi/dependencies/utils.py#L785

So I'd expect this to happen on all request models, but we just don't notice it on Items objects because all extra fields are defined inside the properties field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It makes sense but when I POST a collection and then GET the collection after, the iten_assets field is still there? It's only with PUT that it disappears?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made an issue here - hopefully this can be straightened out with the upcoming stac-fastpapi v3.0.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pytest.mark.asyncio
async def test_collection_extensions(ctx, app_client):
"""Test that extensions can be used to define additional top-level properties"""
Expand Down
5 changes: 2 additions & 3 deletions stac_fastapi/tests/resources/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,5 @@ async def test_search_datetime_validation_errors(app_client):
resp = await app_client.post("/search", json=body)
assert resp.status_code == 400

# Getting this instead ValueError: Invalid RFC3339 datetime.
# resp = await app_client.get("/search?datetime={}".format(dt))
# assert resp.status_code == 400
resp = await app_client.get("/search?datetime={}".format(dt))
assert resp.status_code == 400