Repository navigation
Add bulk_items endpoint - #16
emmanuelmathot wants to merge 1 commit into
Conversation
|
@m-mohr @ahmed-hassan19 Any thoughts on this pr? |
|
Wasn't there already such functionality defined in the original endpoint or in OGC API - Features? |
m-mohr
left a comment
There was a problem hiding this comment.
Okay, checked it: The existing POST /collections/{collectionId}/items already accepts a partial ItemCollection (see the second rule list under POST and postOrPutItemCollection in the OpenAPI definition), and stac-fastapi-pgstac implements that too. OGC API - Features - Part 4 only covers single resources and leaves batch/atomic operations to a future standard.
Also, the PR doesn't match stac-fastapi's /bulk_items: it takes a different request body (items keyed by id plus an insert/upsert method, not an ItemCollection), returns 200 instead of 201, and has a different response body.
I'd rather not specify a second endpoint for the same operation, unless I'm missing something important. The missing parts (partial-success reporting, and maybe upsert) could be solved on /items, as discussed in #20. If upsert is needed, it could be an option on /items as well.
|
@m-mohr I see where you're coming from about not duplicating endpoints, but maybe having a dedicated endpoint like |
|
But isn't items already overloaded? The partial ItemCollection is already defined there... |
|
I agree with m-mohr. The spec already has separate rules for a single Item and an ItemCollection on I can include this in the #20 PR. |
|
I'm ok with deprecating /bulk_items |
|
I am ok too. This PR is actually acting a de-facto usage because I discovered that /items is not implemented properly to insert bulk items. |
|
sounds good to me as well |
|
Sorry I'm having second thoughts after reviewing stac-utils/stac-fastapi#987 If I summarize my understanding:
I feel we should update the |
|
Looking closely at the OGC API - Features - Part 4 draft, it explicitly states in Section 1 (Scope):
Furthermore, Requirement 6 mandates that a successful POST must return a 201 with a This confirms that OGC Part 4 was strictly designed for single-resource operations. By overloading Instead of trying to hack partial-success batch reporting into the single-item OGC endpoint, should we:
|
|
My main critique here was only really that we should not have two similar solutions for the same problem. So I'd be in for strict OGC alignment, which is likely a 2.0.0 for our Transaction Extension due to the breaking removal of batch support and other small differences. The batch transactions are OGC API - Features - Part 11, see https://github.com/opengeospatial/ogcapi-features/tree/master/proposals/atomic-batch-tx - It seems more complex than what bulk_items was though. Issue with it is the dependency on OGC and it just evolving much slower. I doubt they would stop anyone from moving Part 4 and 11 forward though. Question is a bit how far Part 4 is - something to check with Clemens and Peter. |
|
We could create a separate API extension for bulk items and remove item_collection support from here |
|
I'm changing my earlier position: jonhealy1's point about Part 4's scope is fair. Part 4 leaves batches to a separate standard, so the #20 contradiction comes from accepting an ItemCollection on Two points from the current OGC drafts matter for the split:
Should the #20 status-code and partial-success contract move to the new bulk extension instead of this repo? If so, reusing Part 11's response member names would keep a later move to |
|
@ahmed-hassan19 I agree. @m-mohr @emmanuelmathot what do you think? I think @vincentsarago supports this. |
|
Note that all of these are still drafts and can change over time. That's the reason why we departed from OGC alignment at 1.0.0 release and kept alignment as a todo for later. It might make sense to check with the editors at OGC first what their status is and what's still planned to change (maybe some issue triage helps). Do we want to break multiple times? If not, I'd try to just fix whatever is currently needed and then break when OGC finally got through with a final releases. I don't have a strong opinion myself. |
|
Agreed that we should break only once. That allows a single break in two steps:
If that works for everyone, we can check with the editors at OGC on opengeospatial/ogcapi-features#415 what's still expected to change in Part 4 before step 2. |
|
@ahmed-hassan19 I think this sounds good |
This PR reflect de facto implementation of bulk items POST in stac-fastapi-pgstac
Proposed Changes:
POST /collections/{collectionId}/bulk_itemsPR Checklist: