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

Support creating ItemCollections in Transaction Extension #35

Merged
merged 13 commits into from
May 17, 2023

Conversation

mmcfarland
Copy link
Contributor

@mmcfarland mmcfarland commented May 11, 2023

Description:

Implements "create ItemCollection" via the Transaction extension and provides additional validation and behavior on ids when creating Items or ItemCollections. I'll note that the api spec indicates percent encoded characters are discouraged, but this change makes them invalid for this backend. That's an opinioned change, and I'm willing to walk it back to a subset (like just "/") if that flexibility is desired.

See: https://github.com/radiantearth/stac-spec/blob/master/best-practices.md#item-ids
See: https://github.com/radiantearth/stac-api-spec/blob/master/ogcapi-features/extensions/transaction/README.md#methods

Fixes: #23

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

The image copies the root project to /app and matching that through
docker-compose allows host file updates to be copied without rebuilding
the image.
Updates to the transaction spec indicate POST against items should allow
ItemCollection.
In the transaction extension, Items and Collection can't have mismatched
ids from the path, but should have the path collection id applied if it
is missing. Ids for both are also not allowed to be a "percent encoded"
value per RFC 3986.
@mmcfarland
Copy link
Contributor Author

mmcfarland commented May 11, 2023

Note: This is draft until stac-utils/stac-fastapi#574 is released, as tests here will fail without it.

@gadomski gadomski self-requested a review May 11, 2023 18:58
stac_fastapi/pgstac/transactions.py Show resolved Hide resolved
stac_fastapi/pgstac/transactions.py Outdated Show resolved Hide resolved
stac_fastapi/pgstac/transactions.py Outdated Show resolved Hide resolved
@gadomski gadomski added this to the 2.4.7 milestone May 15, 2023
The spec leaves the return type for Item creation open to the
implementation. This change unifies the response of both
Item/ItemCollection POST requests to return an empty response with a
Location header for the newly created single Item, in that case.
Use a setting value instead of a constant so that IDs could be set per
instance.
@gadomski gadomski self-requested a review May 15, 2023 21:30
After realizing the extent of the breaking change resulting from a
unified response between Item/ItemCollection Tx endpoint, restoring the
original behavior.
@mmcfarland
Copy link
Contributor Author

@gadomski I added some commits that should address your comments, thanks for the feedback. I had started down the path of response unification, but then realized the extent to which it was a meaningful breaking changed, and walked it back in a subsequent commit. Tests pass locally against stac-fastapi main, so I'll leave this in draft until the next stac-fastapi release.

@gadomski gadomski marked this pull request as ready for review May 17, 2023 15:31
@gadomski gadomski enabled auto-merge (squash) May 17, 2023 15:49
@gadomski gadomski merged commit 862f59e into stac-utils:main May 17, 2023
6 checks passed
@mmcfarland mmcfarland deleted the mjm/trasaction-item-collection branch May 17, 2023 15:50
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.

Quasi-nested collections can be created but not accessed or deleted
2 participants