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

use Collection Pydantic model in PutCollection transaction #679

Merged
merged 2 commits into from
May 2, 2024

Conversation

vincentsarago
Copy link
Member

@vincentsarago vincentsarago commented Apr 26, 2024

Not sure why this was not in #625

Note: we should add a note in the changelog that transaction endpoint now have Pydantic Model instead of TypedDict as input (stac-utils/stac-fastapi-pgstac#108 (comment))

@vincentsarago vincentsarago merged commit e4e4120 into main May 2, 2024
7 checks passed
@vincentsarago vincentsarago deleted the patch/PutCollection-pydantic-model branch May 2, 2024 08:19
@@ -34,7 +33,7 @@ class PutItem(ItemUri):
class PutCollection(CollectionUri):
"""Update Collection."""

collection: stac.Collection = attr.ib(default=Body(None))
collection: Collection = attr.ib(default=Body(None))
Copy link
Member Author

Choose a reason for hiding this comment

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

@jonhealy1 I'm not sure why but when we use this class (attr) we don't get the validation/serialization 😬

from stac_fastapi.extensions.core.transaction import PutCollection

>>> PutCollection(collection_id='yo', collection={})
PutCollection(collection_id='yo', collection={})

>>> print(type(PutCollection(collection_id='yo', collection={}).collection))
<class 'dict'>

you may have seen this also in the elastic search backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants