Skip to content
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

Support .Args.XYZ instead of stencil.Arg "XYZ" #48

Open
deregtd opened this issue Apr 19, 2024 · 5 comments
Open

Support .Args.XYZ instead of stencil.Arg "XYZ" #48

deregtd opened this issue Apr 19, 2024 · 5 comments
Labels
enhancement New feature or request status/backlog Issues in the backlog

Comments

@deregtd
Copy link
Collaborator

deregtd commented Apr 19, 2024

Args are so common, for quality-of-life, just fill them into the base go-template vars under Args or Arg

@jaredallard
Copy link
Member

Yeah, this makes sense to do. I think we probably need to move the JSON schema validation to before render time as well.

@jaredallard jaredallard added the enhancement New feature or request label Apr 25, 2024
@jaredallard
Copy link
Member

jaredallard commented Apr 26, 2024

Hmmmm, I'm not sure this is a good idea. That would break the default logic, which would make dealing with arguments significantly more annoying. For example, stencil.Arg "a.b.c" would parse the JSON schema and set the default value for that type if it's not set at accessing time, while {{ a.b.c }} would just return nil. We could retain that behaviour by building that entire map based on the JSON schema, but that feels much less clean for little benefit.

I'll still consider this, but I'm not sure if it's worth it.

@deregtd
Copy link
Collaborator Author

deregtd commented Apr 26, 2024

Oh are there defaults supported by the schema? I'm not sure I've ever used those... I would expect that defaults are made through usage in templates, not the schema. (i.e. if a.b.c != nil)

@jaredallard
Copy link
Member

Oh are there defaults supported by the schema? I'm not sure I've ever used those... I would expect that defaults are made through usage in templates, not the schema. (i.e. if a.b.c != nil)

Hmmm, that's fair. I guess most people would be more familiar with default from sprig, also.

@deregtd
Copy link
Collaborator Author

deregtd commented Apr 26, 2024

Yeah that's the system I used several places. Basically a COALESCE() operator.

@jaredallard jaredallard added the status/backlog Issues in the backlog label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request status/backlog Issues in the backlog
Projects
Status: Backlog
Development

No branches or pull requests

2 participants