feat: adds action templates and reusable actions#296
feat: adds action templates and reusable actions#296
Conversation
|
I like the general direction. |
|
Feedback from the meeting from both @lornajane and @ralfhandl :
|
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
e709bde to
06a21c9
Compare
ralfhandl
left a comment
There was a problem hiding this comment.
Mostly wording and capitalization
Co-authored-by: Ralf Handl <[email protected]>
Co-authored-by: Ralf Handl <[email protected]>
Co-authored-by: Ralf Handl <[email protected]>
versions/1.2.0-dev.md
Outdated
|
|
||
| | Field Name | Type | Description | | ||
| | ---- | :----: | ---- | | ||
| | <a name="action-reference-ref"></a>$ref | `string` | **REQUIRED** A valid reference to an action in the components section, represented as `#/components/actions/actionTemplateKey`. | |
There was a problem hiding this comment.
The correct way to define this is to say that the value is a same-document (or fragment-only) relative URI reference, per RFC3986 §4.4, and that the fragment syntax is JSON Pointer, with the pointer prefix restricted to /components/actions/.
It looks to me like the reference resolution mechanism here is delegation, as in JSON Schema draft 2020-12, and not replacment, as there is another field in this Object. That should be called out explicitly.
There was a problem hiding this comment.
Thanks! I have updated the wording with your suggestion in the Action Templates Reference Object section. Let me know what you think!
Signed-off-by: Vincent Biret <[email protected]>
…rlay-Specification into feat/action-templates Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
|
@ralfhandl @lornajane I pushed another update a couple of minutes ago. I wasn't happy about the whole reusable actions vs action templates kind of thing. After chatting with @mikekistler internally I realized we could simply define a an action template reference object as "you can override anything from the resolved template in the reference" like JSON schema does to some extent. And keep things extra simple. Let me know what you think! |
…ferences Signed-off-by: Vincent Biret <[email protected]>
mikekistler
left a comment
There was a problem hiding this comment.
I think this will be a very useful enhancement to overlays, but it needs some work to make it understandable to users.
I left some suggestions for wording changes and simplification. These are mainly as seed for discussion in our next Overlays SIG meeting.
|
|
||
| | Field Name | Type | Description | | ||
| | ---- | :----: | ---- | | ||
| | <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in the actions. Optional. | |
There was a problem hiding this comment.
| | <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in the actions. Optional. | | |
| | <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in action template instantiations. Optional. | |
|
|
||
| #### Action Template Object | ||
|
|
||
| This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references. |
There was a problem hiding this comment.
| This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references. | |
| This object is a template that, when instantiated by an Action Template Instantiation, represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references. |
| #### Action Template Object | ||
|
|
||
| This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references. | ||
|
|
There was a problem hiding this comment.
| An action template is similar to an action, but differs in two important ways: | |
| 1. It may omit any action field, in particular the `target` field, as these may be supplied by the Action Template Instantiation. | |
| 2. Any action field may employ string interpolation using variables specified in the `parameters` or `environmentVariables` fields. |
| This object MAY be extended with [Specification Extensions](#specification-extensions). | ||
|
|
||
|
|
||
| #### Action Template Reference Object |
There was a problem hiding this comment.
I think calling this a "Reference Object" is confusing and inconsistent with other uses of this terminology. I suggest calling this an "Action Template Instantiation Object", as it's primary function is to "instantiate" a template.
| | ---- | :----: | ---- | | ||
| | <a name="action-template-reference-ref"></a>$ref | `string` | **REQUIRED** A [same-document](https://www.rfc-editor.org/rfc/rfc3986.html#section-4.4) (or fragment-only) relative URI reference, per RFC3986 §4.4, and that the fragment syntax is JSON Pointer, with the pointer prefix restricted to `/components/actionTemplates/`. | | ||
| | <a name="action-template-reference-parameter-values></a>parameterValues | `Map(string, Any)` | A set of values to use for the template parameters, the key MUST match the parameter name. Optional. | | ||
| | <a name="action-template-reference-action-fields"></a>Any field defined in the [action object](#action-object) | mixed | Any field defined in the [Action Object](#action-object) to be used as an override to the value resolved in the template. The [string literal replacement syntax](#string-literal-replacement-syntax) MAY NOT be used for any of the fields. Optional. | |
There was a problem hiding this comment.
I think we could eliminate the action fields here. They are already allowed in the template, so the action field in the template could be defined with a parameterize value, and the field value can then be passed in a parameter value. So eliminating the action fields here loses no functionality.
This pull request adds action templates.
fixes #33
fixes #136
fixes #270
closes #238
This is another attempt to solve a scale limitation in the current specification. Action templates are better than the previous parameters proposal because:
The pull request is incomplete as it is, it's a draft, I want to collect feedback on the approach before making any further investments.