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: proposals/004_Overlays.md
+14-13
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,12 @@
15
15
|---- | ---------------- | ---------- |
16
16
| 24th December 2019 | Darrel Miller | Initial draft |
17
17
| 2nd January 2019 | Darrel Miller | Update to wording around removing items from arrays. Added section on backward compatibility. Clarified process around applying a set of updates. Started to add supported scenarios.|
18
+
| 29th July 2020 | Darrel Miller | Updated to be explicit about update operations |
18
19
19
20
## Introduction
20
21
21
22
In recent months we have been discussing various use cases for overlays and various solutions. The following proposal takes a somewhat more radical approach to the problem. It is a more ambitious proposal than the others we have seen before but the additional complexity does allow for supporting many of the scenarios that have been discussed to date.
An overlay document contains a list of [Update Objects](#overlayUpdates) that are to be applied to the target document. Each [Update Object](#updateObject) has a `target` property and a `value` property. The `target` property is a [JMESPath](http://jmespath.org/specification.html) query that identifies what part of the target document is to be updated and the `value` property contains an object with the properties to be overlaid.
@@ -63,10 +63,11 @@ This object represents one or more changes to be applied to the target document
63
63
Field Name | Type | Description
64
64
---|:---:|---
65
65
<aname="updateTarget"></a>target | `string` | A JMESPath expression referencing the target objects in the target document.
66
-
<aname="updateValue"></a>value | [Any](#valueObject) | An object with the properties and values to be updated in the target document. Property has no impact if `remove` property is `true`.
66
+
<aname="updateAdd"></a>add | [Any](#addObject) | An object to be added as a child of the object(s) referenced by the target. Property has no impact if `remove` property is `true`.
67
+
<aname="updateMerge"></a>merge | [Any](#mergeObject) | An object with the properties and values to be merged with the object(s) referenced by the target. Property has no impact if `remove` property is `true`.
67
68
<aname="updateRemove"></a>remove | `boolean` | A boolean value that indicates that the target object is to be removed from the the map or array it is contained in. The default value is false.
68
69
69
-
The properties of the `Value Object` MUST be compatible with the target object referenced by the JMESPath key. When the Overlay document is applied, the properties in the `Value Object` replace properties in the target object with the same name and new properties are appended to the target object.
70
+
The properties of the merge object MUST be compatible with the target object referenced by the JMESPath key. When the Overlay document is applied, the properties in the merge object replace properties in the target object with the same name and new properties are appended to the target object.
70
71
71
72
##### Structured Overlays Example
72
73
@@ -79,7 +80,7 @@ info:
79
80
version: 1.0.0
80
81
updates:
81
82
- target: "@"
82
-
value:
83
+
merge:
83
84
info:
84
85
x-overlay-applied: structured-overlay
85
86
paths:
@@ -103,17 +104,17 @@ Alternatively, where only a small number of updates need to be applied to a larg
103
104
```yaml
104
105
overlay: 1.0.0
105
106
info:
106
-
title: Structured Overlay
107
+
title: Targeted Overlays
107
108
version: 1.0.0
108
109
updates:
109
110
- target: paths."/foo".get
110
-
value:
111
+
merge:
111
112
description: This is the new description
112
113
- target: paths."/bar".get
113
-
value:
114
+
merge:
114
115
description: This is the updated description
115
116
- target: paths."/bar"
116
-
value:
117
+
merge:
117
118
post:
118
119
description: This is an updated description of a child object
0 commit comments