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

Transaction extension inconsistency #610

Closed
StijnCaerts opened this issue Oct 12, 2023 · 4 comments
Closed

Transaction extension inconsistency #610

StijnCaerts opened this issue Oct 12, 2023 · 4 comments

Comments

@StijnCaerts
Copy link
Contributor

The collections operations are not part of the transaction API extension (yet). But these endpoints are already implemented in stac-fastapi.
It would be nice if the operations are more consistent with the item operations.

For example, to update a collection, use the PUT /collections/{collection_id} endpoint explicitly including the collection ID.
It looks like it is also intended to be implemented like this according to this documentation snippet:

"""Transaction Extension.
The transaction extension adds several endpoints which allow the creation,
deletion, and updating of items and collections:
POST /collections
PUT /collections/{collection_id}
DELETE /collections/{collection_id}
POST /collections/{collection_id}/items
PUT /collections/{collection_id}/items
DELETE /collections/{collection_id}/items

However right now, the update collection endpoint doesn't include the collection ID:

def register_update_collection(self):
"""Register update collection endpoint (PUT /collections)."""
self.router.add_api_route(
name="Update Collection",
path="/collections",
response_model=Collection if self.settings.enable_response_models else None,
response_class=self.response_class,
response_model_exclude_unset=True,
response_model_exclude_none=True,
methods=["PUT"],
endpoint=create_async_endpoint(
self.client.update_collection, stac_types.Collection
),
)

@philvarner
Copy link
Collaborator

philvarner commented Oct 12, 2023

The plan is to have a separate Collection Transaction Extension specification from the existing (item) Transaction Extension spec. See this PR + thread: stac-api-extensions/transaction#4 No one has committed to working on this yet, but it is generally agreed upon as a useful feature. stac-server also has support for POST create of a Collection: https://github.com/stac-utils/stac-server/blob/3299c6d0f344d87635bdea8d68d52f42d7991148/src/lambdas/api/app.js#L152

I agree that the existing non-standard support for collection transactions should be more aligned with the Transaction Extension for items, which tries to follow a typical RESTful / HATEOAS style. I would also say that the (inaccurate) documentation of the existing endpoint should instead be:

  • POST /collections (create new collection)
  • PUT /collections/{collection_id} (replace an existing collection entirely)
  • PATCH /collections/{collection_id} (partial update to an existing collection)
  • DELETE /collections/{collection_id} (delete a collection. recursive or non-recursive?)

(note that the existing Transaction support doesn't support PATCH -- I filed this last year #375)

@jonhealy1
Copy link
Collaborator

I feel like we should make a pr to fix this for now.

@jonhealy1
Copy link
Collaborator

jonhealy1 commented Apr 11, 2024

#631

@jonhealy1
Copy link
Collaborator

Closing but feel free to re-open.

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

No branches or pull requests

3 participants