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

[lang] support multiline arguments to annotations #149

Open
cppforlife opened this issue May 27, 2020 · 3 comments
Open

[lang] support multiline arguments to annotations #149

cppforlife opened this issue May 27, 2020 · 3 comments
Labels
enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.

Comments

@cppforlife
Copy link
Contributor

cppforlife commented May 27, 2020

Describe the problem/challenge you have
I want to be able to annotate a node using an expression formatted over multiple lines, but ytt currently only accepts a single line per annotation.

Describe the solution you'd like
For example,

#@schema/desc """
#@ something something
#@ """
a: 123

#@overlay/match by=overlay.subset({
#@  "kind": "Foo",
#@  "metadata": {"blah": "blah"},
#@ })
b: 123

Anything else you would like to add:


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@cppforlife cppforlife added the enhancement This issue is a feature request label May 27, 2020
@cppforlife cppforlife added the deferred An interesting idea worth considering, but currently tabled. label Aug 12, 2020
@pivotaljohn
Copy link
Contributor

@pivotaljohn pivotaljohn added priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. and removed deferred An interesting idea worth considering, but currently tabled. labels Apr 22, 2022
@cmoulliard
Copy link

We should also to have the possibility to pass the function to the next line
Now

--- #@ generate_certificate(name,namespace,cert_duration,cert_renew_before,cert_secret_name,common_name,dns_names,cert_subject, cert_keystore, issuer_name)

Expected

--- 
#@ generate_certificate(name,namespace,cert_duration,cert_renew_before,cert_secret_name,common_name,dns_names,cert_subject, cert_keystore, issuer_name)

and pass the args on multilines
Now

--- #@ generate_certificate(name,namespace,cert_duration,cert_renew_before,cert_secret_name,common_name,dns_names)

Expected

--- 
#@ generate_certificate(name,namespace, 
                        cert_duration,
                        cert_renew_before,
                        cert_secret_name,
                        common_name,
                        dns_names)

@pivotaljohn
Copy link
Contributor

We should also to have the possibility to pass the function to the next line

I see how the format you're looking for is more intuitive. 👍🏻

However, it's one thing to recognize an annotation is spilling over onto subsequent lines.
It's a whole 'nother thing to start to attach annotations to a node that is above the annotation.

Little known fact: the #@ is a short-hand for two annotations.
When #@ appears to the right of a node, it's (internally) identified as a #@template/value annotation. When there is no node to the left of the annotation it's a #@template/code.

  • @template/value annotations compile into code that sets the value on the decorated node.
  • @template/code contributes raw Starlark code to the template.

So, we'd start introducing corner-cases into this crucial "algorithm" that identifies to which node an annotation is attached and what kind of @template/... annotation is implied.

Not saying it's not possible; noting the internal complexity that would result (which increases the risk of bugs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.
Projects
Status: To Triage
Development

No branches or pull requests

3 participants