-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename output.from and output.to #873
Comments
@JBBianchi @matthias-pichler-warrify WDYT?
Personally:
|
Globally, more documentation won't hurt, for sure :) If I can add my grain of salt, we might gain clarity by "splitting"
|
You suggestion is awesome! Much clearer and ubiquitous! This would however get rid of the critical |
Good catch, I didn't think about that ... We could keep the input:
from: ...
schema: ...
output:
to/as: ...
schema: ...
export:
to/as: ...
schema: ... |
The problem with to is that it might user though they can set the destination, which is not really true, so I vote for |
Works for me! Even though I'm not opposed to using On a side note, there is not way to specify the Should therefore be: input:
from: ...
schema: ...
output:
to/as: ...
schema: ...
export: 'myexpression' Or, if we believe we might need additional properties at some point, like @fjtirado said: input:
from: ...
schema: ...
output:
to/as: ...
schema: ...
export:
to/as: .data += .mydata |
It was intentional, why can't we support a schema for the context as well ? I think it's a point that's been raised, even in the previous version of the spec, that we don't know at some point in the workflow, what to expect in the context. With the schema, it give the opportunity to the user to defined what expected of the context to be at a given point in time. |
@JBBianchi because you cannot forecast the state of the context (ex: if a switch state was executed before) at a point in time. AFAIK, that never was brought up, also because you can both update the context (adding a new prop, removing one, etc) and replace it. For the replace it could work but has little to no value. For the update, that would be impossible or at least impractical (diff patch or replace), for little to no value. IMO there's no way you, or any user, would like to document a whole schema just for updating a prop in a data bag (unordered, untyped). |
@cdavernas I can foresee schema for context being used by users that want to restrict the context content (I do agree with you that the most frequent use case is "free" context ;)). As far as is optional I do not see any issue. |
I don't really agree with your arguments. Since the user defines the context, it is predictable. The user knows the types of operations being performed (merge, replace, patch, etc.) on the context. The only point I agree with is that writing the schemas can become cumbersome. It involves copying and pasting them, they might be complex, and most users won't bother. However, most users also won't utilize input/output schemas, at least not within the workflow. Nevertheless, I believe it is valuable to understand the structure of the data at any given point. That being said, we can postpone this discussion for now. I believe we've reached a consensus on replacing |
@JBBianchi I prefer |
It might be very valuable though to validate a subset of properties in the context. JSON Schema objects have type: object
properties:
foo:
type: number allows all the following values: {
"foo": 1
} {
"foo": 1,
"bar": true
} so it is trivial to write a context schema that for example only validates the exported properties 👍 It is not required to copy paste the schema to every task. On another note the workflow schema also does not specify |
+1 @matthias-pichler-warrify to fix the validation, hence I think we can also improve our CI to have invalid DSLs |
I forgot to include export definition in the task.
I forgot to include export definition in the task. Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
I forgot to include export definition in the task. Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
[Fix #873] Fixing error in export definition
Output.from expression indicates the result of the task (and can be consumed by subsequent task)
Output.to expression indicates what should be the value of the context once the task is completed.
I think the names are confusing (it actually takes me a lot of time to understand why do we have two expressions in output), so I think we must change them.
output.from might be renamed to output.result (the expression indicates the result of the task)
output.to might be renamed to output.setContext (clearly states the purpose is to the set the value of the context), If we found that setContext break the single word paradigm that we are implicitly following in the DSL, then lets just use output.context.
Also we need to explicilly indicate in the documentation that it is assumed that the expression language should support merging context.
Related to that, if this assumption turns to be wrong, another possibility is to use
Right now, context will only support set: but we leave the door open to add append:, delete: or merge: in future if needed
The text was updated successfully, but these errors were encountered: