You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-17Lines changed: 15 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,6 @@ The REST Layer framework is composed of several sub-packages:
65
65
-[Data Validation](#data-validation)
66
66
-[Nullable Values](#nullable-values)
67
67
-[Extensible Data Validation](#extensible-data-validation)
68
-
-[JSON Patch](#json-patch)
69
68
-[Timeout and Request Cancellation](#timeout-and-request-cancellation)
70
69
-[Logging](#logging)
71
70
-[CORS](#cors)
@@ -1201,11 +1200,23 @@ Used to query a resource with its sub/embedded resources.
1201
1200
Used to create new resource document, where new `ID` is generated from the server.
1202
1201
1203
1202
### PUT
1204
-
Used to create/update single resource document given its `ID`.\
1205
-
Be aware when dealing with resource fields with `Default` set. Initial creation for such resources will set particular field to its default value if omitted, however on subsequent `PUT` calls this field will be deleted if omitted. If persistent `Default` field is needed use `{Required:true}` with it.
1203
+
Used to create/update single resource document given its `ID`. Be aware when dealing with resource fields with `Default` set. Initial creation for such resources will set particular field to its default value if omitted, however on subsequent `PUT` calls this field will be deleted if omitted. If persistent `Default` field is needed use `{Required:true}` with it.
1206
1204
1207
1205
### PATCH
1208
-
Used to update/patch single resource document given its `ID`.
1206
+
Used to update/patch single resource document given its `ID`. REST Layer supports following update protocols:
1207
+
1208
+
- Simple filed replacement [RFC-5789](http://tools.ietf.org/html/rfc5789) - this protocol will udpate only supplied top level fields, and will leave other fields in the document intact. This means that this protocol can't delete fields. Using this protocol is specified with `Content-Type: application/json` HTTP Request header.
1209
+
1210
+
- [JSON-Patch/RFC-6902](https://tools.ietf.org/html/rfc6902) - When patching deeply nested documents, it is more convenient to use protocol designed especially for this. Using this protocol is specified with `Content-Type: application/json-patch+json` HTTP Request header.
1211
+
1212
+
If using `If-Match` concurrency control as described in the [data control and integrity section](#data-integrity-and-concurrency-control), you could potentially choose to calculate the body of new object client side. Note that the response body for a successful operation can be omitted by supplying a HTTP request header: `Prefer:return=minimal`.
Used to delete single resource document given its `ID`, or via [Query](#quering).
@@ -1288,19 +1299,6 @@ When a validator implements this interface, the method is called with the field'
1288
1299
1289
1300
See [schema.IP](https://godoc.org/github.com/rs/rest-layer/schema#IP) validator for an implementation example.
1290
1301
1291
-
## JSON-Patch
1292
-
1293
-
When patching deeply nested documents, it is more convenient to use protocol designed especially for this, instead of top level document field replacement as described in [RFC-5789](http://tools.ietf.org/html/rfc5789). For this purpose `rest-layer` implements [JSON-Patch/RFC-6902](https://tools.ietf.org/html/rfc6902). In addition JSON-Patch allows field deletion, which is not possible with the simple field replacement.
1294
-
1295
-
If using `If-Match` concurrency control as described in the [data control and integrity section](#data-integrity-and-concurrency-control), you could potentially choose to calculate the body of new object client side. Note that the response body for a successful operation can be omitted by supplying a HTTP request header: `Prefer:return=minimal`.
REST Layer respects [context](https://godoc.org/context) deadline from end to end. Timeout and request cancellation are thus handled through `context`. Since Go 1.8, context is cancelled automatically if the user closes the connection.
0 commit comments