Conversation
|
I like the general direction. |
|
Feedback from the meeting from both @lornajane and @ralfhandl :
|
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
e709bde to
06a21c9
Compare
ralfhandl
left a comment
There was a problem hiding this comment.
Mostly wording and capitalization
Co-authored-by: Ralf Handl <ralf.handl@gmail.com>
Co-authored-by: Ralf Handl <ralf.handl@gmail.com>
Co-authored-by: Ralf Handl <ralf.handl@gmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
…rlay-Specification into feat/action-templates Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
|
@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 <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
…ect nodes Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
|
Sharing some number from the refactor on our internal repos: we're seeing about 30% reduction on average. Of course that number highly depends on how repetitive your Overlay document is. |
mikekistler
left a comment
There was a problem hiding this comment.
Looks good. 👍
I think this is a valuable addition to Overlays and will help expand their adoption.
I wish we could fix some of the terminology quirks we have discussed -- in particular "Reusable Action Objects" -- but I don't want to make perfect the enemy of the good.
handrews
left a comment
There was a problem hiding this comment.
A few minor comments and questions.
versions/1.2.0-dev.md
Outdated
| | ---- | :----: | ---- | | ||
| | <a name="reusable-action-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/actions/`. Component action keys in this pointer MUST be encoded according to [[RFC6901], Section 3](https://www.rfc-editor.org/rfc/rfc6901#section-3). | | ||
| | <a name="reusable-action-reference-parameter-values></a>parameterValues | `Map(string, string)` | A set of string values to use for the reusable action parameters, the key MUST match the parameter name. Optional. | | ||
| | <a name="reusable-action-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 reusable action. 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.
This seems to be missing the field name and type? I see this is true in the other Object where I commented on RFC2119 usage as well? I also don't see a field name in the schema? I am confused here, is this a fixed field, and if so what is its name?
There was a problem hiding this comment.
This comment applies to line 218, I apparently missed when selecting lines 🤦
There was a problem hiding this comment.
The goal here was to say something along the lines of: "any field that's defined for the action object, you can also use here", without duplicating those. But if you think a copy paste instead would make the reading easier, I do that instead, what do you think?
There was a problem hiding this comment.
Please do not duplicate the fields, that will cause trouble later when fields are added to actions and not here.
There was a problem hiding this comment.
Thank you for the input. How do we reword this better so what we mean here is obvious then?
There was a problem hiding this comment.
Seems like the right general idea, but definition has JSON Schema-ish re-use connotations... you could just call it fields?
There was a problem hiding this comment.
Sure! Always happy to get better name suggestions.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
There was a problem hiding this comment.
So the goal is that you can re-use something but adjust it for example by setting a more specific description? I see the use case but I think we need to work on how we describe/represent that. I know Ralf doesn't want the fields duplicated but what if we DO later want to add a field there that can't be used here?
There was a problem hiding this comment.
Here is my suggestion for this:
- At the reusable action level, we define "fields" instead. And that's just an Action object with two caveats, all fields all optional, any string field may use the string interpolation syntax. Making this change solves two issues: the risk of collision in the future (e.g. what if we want to introduce a description that's for the reusable action itself?) and the "trick" of saying "well you can use any field defined over there" which is odd for sure.
- At the reference level:
- we could completely do away with the reference object together, and move the $ref, parameterValues fields in the Action Object, and add conditional statements. I already said that I'm not in favour of that, because we have precedents that conditionals are hard to understand for humans and difficult to encode using JSON schema. (e.g. all the query parameters and headers conditional fields in OAD)
- we could make the same change that Henry suggested for the reusable actions, move everything in fields. But I don't find that ergonomic when you're working next to action objects. (see examples below)
- we could leave it as is, but it seems to add confusion when reading the specification.
- we could move this definition (without duplicating the fields themselves) to a "pattern fields" section like Henry suggested before. At least it'd make it a bit more obvious this definition is "not a regular field" but that it "brings several fields along".
Examples
I'm going to be using JSON on purpose to outline the difference in ergonomics between options 2 or 3 and 4 :
keep at the same level
{
"actions":
[
{
"remove": true,
"description": "Regular Action object that removes something",
"target" : "some target"
},
{
"$ref": "#/components/actions/SomeUpdateAction",
"target": "some target override"
}
]
}introduce a fields node at the reference level
{
"actions":
[
{
"remove": true,
"description": "Regular Action object that removes something",
"target" : "some target"
},
{
"$ref": "#/components/actions/SomeUpdateAction",
"fields":
{
"target": "some target override"
}
}
]
}In this example I find the extra node quite verbose and not very ergonomic when you look at a few actions and reference objects mixed together. Thoughts?
Co-authored-by: Henry Andrews <andrews_henry@yahoo.com>
lornajane
left a comment
There was a problem hiding this comment.
I've got a lot of questions about the intent here (which I thought we'd already been through, so please accept my apologies for asking it again). I hadn't seen, or perhaps hadn't internalised, the use cases where target is getting rewritten in the reusable action as well as the action bit. I think this is beyond the scope of what I had previously seen and I'm uneasy about how approachable it is.
Also I think we use REQUIRED for fields that are required, rather than marking the ones that are not as Optional - so that needs to be consistent.
|
|
||
| A reusable action is similar to an action but differs in important ways: | ||
|
|
||
| 1. It may omit any action field, in particular the `target` field, as these may be supplied by the [Reusable Action Reference Object](#reusable-action-reference-object). |
There was a problem hiding this comment.
I had thought it was not allowed to include the target. The target has to be with the action, but the action definition can be referred to as one of the reusable items from components. What's the use case for supporting action?
There was a problem hiding this comment.
On this instance specifically, I think you've missed a few discussions, either directly here in the PR history, or on the Overlays call. I don't want to re-litigate the whole thing that late in the process. But at a high level:
- We believe that consistency is key, is there really any good reason to allow every field here but target?
- We believe that string interpolation + target are a powerful combination for advanced scenarios, that's actually lead to a huge reduction in my team's context "similar" actions.
- We believe we can also enable simpler scenarios (people who don't want to mess around with string interpolation), by allowing an override at the reference level.
Hopefully that's enough context, let me know if you still have questions or concerns.
| A reusable action is similar to an action but differs in important ways: | ||
|
|
||
| 1. It may omit any action field, in particular the `target` field, as these may be supplied by the [Reusable Action Reference Object](#reusable-action-reference-object). | ||
| 1. String interpolation in a Reusable Action Object using variables specified in the `parameters` or `environmentVariables` fields is only allowed in string fields (`target`, `copy`) and in key or value nodes within the `update` object. It is not allowed in scalar non-string fields such as `remove`. |
There was a problem hiding this comment.
Does it make sense to have remove in a reusable action? If not I am not sure I would refer to it here.
There was a problem hiding this comment.
I think having the reusable action ONLY define remove: true probably does not bring a lot of value in itself. However, if the description field and/or the target fields are using string interpolation, then it becomes interesting. We have this scenario for example where we remove a bunch of "preview" enum values across the document. In that case, it's fairly easy and useful to have a reusable action with the 3 fields, 2 templated (description and target)
versions/1.2.0-dev.md
Outdated
| | ---- | :----: | ---- | | ||
| | <a name="reusable-action-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/actions/`. Component action keys in this pointer MUST be encoded according to [[RFC6901], Section 3](https://www.rfc-editor.org/rfc/rfc6901#section-3). | | ||
| | <a name="reusable-action-reference-parameter-values></a>parameterValues | `Map(string, string)` | A set of string values to use for the reusable action parameters, the key MUST match the parameter name. Optional. | | ||
| | <a name="reusable-action-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 reusable action. 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.
So the goal is that you can re-use something but adjust it for example by setting a more specific description? I see the use case but I think we need to work on how we describe/represent that. I know Ralf doesn't want the fields duplicated but what if we DO later want to add a field there that can't be used here?
Co-authored-by: Lorna Jane Mitchell <github@lornajane.net> Co-authored-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
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.