-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Consider removing type from params (or _really_ support types) #1393
Comments
I was thinking about this issue in the context of beta and in particular how @afrittoli and @vdemeester mentioned that the Array "merge" support was solving a real problem they had in the plumbing project. I think removing Array support is just going to be a big pain and also believe that we want to support Param typing in the futures so... instead of removing it we should just ensure our current use of So... my only real reservation is with the merge syntax of the array type -- https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#variable-substitution-with-parameters-of-type-array
It's not bad, but gives the impression that the array-param itself will be added to the array as opposed to being merged in and there maybe cases in the future where that is the desired behavior. I do not want to encourage too much smarts in our interpolation but I would suggest borrowing some bash syntax to express the array being expanded helps here.
Anyway, I'll wait a few days for feedback but then open a new issue just for the array merge syntax and assign it to 0.9 and close this issue. |
Actually a slightly better syntax in this case is to use a spread operator. e.g.
Our lookup syntax is closer to a json lookup than flat bash interpolation. A spread operator is slightly more future-proof and from a parser point of view does not introduce a new magic encoding rule |
If we do want to make the syntax more powerful, it would be great if we could align with Triggers which is already using a more powerful syntax (https://github.com/tektoncd/triggers/blob/master/docs/triggerbindings.md#event-variable-interpolation) tho also currently debating which syntax to use (tektoncd/triggers#178) |
I'm all for aligning on the syntax and reusing an existing one like CEL or JSONPath instead of inventing our own! 👼 |
For param lookup we currently support "dot-notation". (Hurray!)
To that the only new accessor we "might" want to add is "bracket-notation" for indexed array access. I suspect there may be existing precedent for that in Kubernetes too but haven't looked and cannot see how the syntax would be controversial. So...
For "accessors" I think that syntax is already pretty standard and likely sufficient. I'm still hoping we can avoid the need for strong predicate support like in JSONPath etc. but who knows. One reservation I have is that unlike simple property access there is no defacto standard for predicates. |
@dibyom Reading the triggers issue... https://github.com/kubernetes/client-go/tree/master/util/jsonpath looks like it might be reasonable -- the minimal syntax above is of course more than covered by JSONPath. e.g. We might not need all of JSONPath but that's the syntax we can/should align with if we add new capabilities. |
For the typing piece of parameters I'm looking at .. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject -- this might feel verbose but I'm actually only concerned about the type aspect or "schema" let me try to put together an example. e.g. where Also see... https://json-schema.org/understanding-json-schema/basics.html |
The idea here would be to use
In terms of implementation change what this would mean is that There obviously is a bunch of work here to get interpolation working properly but the general idea is that we would follow JSONPath style lookup to support extracting fields from structures and arrays. For example:
In terms of how parameter values are interpolated they should be interpreted as emitting their character representation into the parse stream. For the scalar types this is more-or-less a fancy way of saying string substitution with the exception that string types should omit quotes when concatenated with an existing string. For array and objects they should emit their structure in-place where they were referenced. For example for
Going back to the original array example from a few comments ago it makes sense to align with JSONPath for expansion syntax so we would use ["first", "$(params.array-param[])", "last"] to expand out an array. This actually really works well now as array-param[] creates a comma separated list of values (which serializes to "val1", "val2") as opposed to an array ["val1", "val2"]. So.... |
/assign |
This is a cool idea @skaegi - and I think it ties into some discussions we've had before about validating params before as well. I'm really excited we have someone looking closely at this!! :D I think this could be great for folks that want to express complicated types and restrictions - do you have any thoughts on how we might be able to support this and also more simple use cases? e.g. say I just want a string, and I want it to be non-empty. Or I want to default it. I'm thinking to support those use cases we'd want to have some simple "types" out of the box? |
so... I think the schema and jsonpath stuff is probably post "beta". I think the above approach is probably reasonable and good enough that we should also firm up plans for what we want to support in beta so as to avoid future problems. I'll open a separate issue for the schema/jsonpath stuff as my intent is to continue moving on it but again... post beta unless people feel strongly. This issue can just focus on beta and the original issue title ;) So... for beta I propose that we...
|
If we remove type, how does the user (and/or consumer like the
I'm fine with "breaking" stuff now, before beta 👼 |
I just noticed I never came back and updated this issue. For beta (and for the rest of time) we will continue to have |
I believe the accessors listed in this parameter is on the param type array. Does this issue include indexing the params array in a task? |
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding more support for array params by adding array results as well as the ability to index into arrays. It refers to TEP-0075 which will be added in a separate commit, which proposes adding support for dictionary types. Related issues: * [pipelines#1393 Consider removing type from params (or _really_ support types)](tektoncd/pipeline#1393) * [pipelines#3255 Arguments of type array cannot be access via index](tektoncd/pipeline#3255)
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This TEP proposes adding support for more structured params and results by introducing objects (aka dictionaries), and introducing a (small) subset of json schema syntax for declaring keys in the object. This refers to TEP-0074 which will be added in a separate commit and proposes deprecating PipelineResources. This is based on @skaegi's proposals in tektoncd/pipeline#1393
This feature request was addressed in TEP-0075: Object/Dictionary param and result types - feel free to reopen if there are more related requests |
I'm here following Emun parameter support issue(#2610) and could not find any features for enum (only string type) yet in code. What's current status? Is it planned to support other types (specifically enum) rather than string? |
We currently have
params
of type string and array with string being far more typical. Support for the array type does not strictly seem required and can be worked around without undue hardship. On the flip-side interpolation of an array type param inside of a string is both limited and not terribly intuitive. In addition all use of $(variable) interpolation in core Kubernetes is string based.I'm proposing we remove type support from Param and ParamSpec for now until we're sure what we want to do with param types.
The text was updated successfully, but these errors were encountered: