opengeospatial / ogcapi-features

An open standard for querying geospatial information on the web.
https://ogcapi.ogc.org/features
Other
342 stars 85 forks source link

PATCHing a single Feature: JSON Patch vs JSON Merge, and bulk operations on /collections/{collectionId}/items #290

Open hgs-sellis opened 5 years ago

hgs-sellis commented 5 years ago

In the initial set of notes for Simple Transactions it is proposed to use JSON Patch for PATCHing a single feature on the /collections/{collectionId}/items endpoint. 2 sprints ago, the STAC group decided to use JSON Merge for that operation, mainly because of its relative simplicity.

See STAC's: Transaction API Extension

Here is a good discussion of the pros and cons of both specs: https://erosb.github.io/post/json-patch-vs-merge-patch/

The major trade-off for the simplicity of JSON Merge is its inability to manipulate the contents of an array. Arrays can only be replaced with an new value.

Question 1:

Since the idea is to keep simple transactions simple, perhaps the OAF proposal could be changed to use the simpler JSON Merge spec for "Simple Transactions," and the more complex and powerful JSON Patch spec for "Complex Transactions?" E.g. JSON Patch can be easily reversed for a rollback operation, which is not true of JSON Merge.

Question 2:

In the most recent STAC sprint, we proposed adding simple bulk POST and DELETE to the /collections/{collectionId}/items endpoint as well. It is simple in the sense that it conforms to the OAF concept of "batch," meaning each operation in the bulk request succeeds or fails independently, without support for roll back in the case of an individual failure.

For details, see PR: Bulk CRUD #634

The STAC group would like to ask if the OAF group would consider aligning their "Simple Transaction" API with the existing STAC spec and with the proposal for simple bulk operations on the /collections/{collectionId}/items endpoint.

cportele commented 5 years ago

Q1: In OGC Testbed 15 we also looked at the two JSON PATCH RFCs and decided to use JSON Merge Patch (RFC 7396) because of its simplicity for both servers and clients. This was not for feature transactions, but for other JSON resources. So, I would be in favour of JSON Merge Patch, too. But I still think that it should be optional (i.e. a separate conformance class, also because it only applies to JSON cases).

cportele commented 3 years ago

Meeting 2021-09-13: Q1 has been resolved (we also use JSON Merge Patch). Q2 will only be addressed in a future work item supporting also other more advanced transaction capabilities as we want to restrict Part 4 to resource manipulation that directly maps to HTTP.