-
Notifications
You must be signed in to change notification settings - Fork 10
bug: onMissing.action.inject confusing for multi-query #114
Comments
currently, inject only occurs if no results are found on the query, since metadata.name exists in your example, inject is not triggered for any of the paths, this functions as an OR statement, if any of these paths exist, don't inject. |
@JefeDavis i've had time to digest this a bit. I think the confusion may be in the term This may be something where you have a separate statement like:
In which case, no query is needed. You are just saying "inject it here". I think that would avoid the confusion of But it still seems a bit confusing if you are saying "query these things and if they are missing inject them" while using OR logic for the paths. Just my random Friday thoughts on this one. :) |
@scottd018 if I remember correctly you should be able to do multiple inject paths it uses the same object as query but with tighter validation to ensure no wild cards |
@JefeDavis yes, that's true. You could use a single query and many injectPaths. I think the problem here is that the query is returning something that does in fact exist, so it does not inject it, where the intention of I think the easiest way to alter/override this behavior (so to reduce number of instruction operations required like in @scottd018 example) would be to add a
Let me know what you think about adding that feature @JefeDavis. It would obviously create a version update due to backward compatibility with the existing instructions spec, otherwise see below... The alternative (no new code) solution here @scottd018 is to have a separate overlay instruction for the 1 item that currently exists in your |
Although on second thought, I feel that it should be handling each query in the array as a separate item, and therefore only the ones that are missing are to be injected and ones that have an existing value should be set to the desired value. So there wouldn't be a need for a |
@ahuffman I tend to agree with you. @JefeDavis and I discussed this yesterday. The problem is in the logic for the I think there are 1 of 2 options to solve this:
|
I think the real problem is why the |
sorry. I didn't realize there was a separate |
Essentially each item in
|
@ahuffman that is my understanding as well and I believe should be the desired outcome for optimal UX. |
@ahuffman @scottd018 just I chime in quick injectPath is also required if your query uses wildcards or filters as the inject location needs to be in dot notation to know where to actually inject |
All paths with multi-query should show up on action inject.
Sample Manifest (
/tmp/manifest.yaml
):Sample Instruction File (
/tmp/instructions.yaml
):Output of
yot -i /tmp/instructions.yaml -s
:Expected:
The text was updated successfully, but these errors were encountered: