Closed kieron-dev closed 2 years ago
I've just seen the alternative method for doing this in the FAQs: https://carvel.dev/ytt/docs/latest/faq/#can-i-load-multiple-functions-without-having-to-name-each-one. Using struct.make
rather than struct.encode
works.
I suggest updating the docs to move the collection of functions example from struct.encode
to struct.make
.
Thanks for making this issue, this is a error in the documentation. struct.encode()
does not work for functions so the example should be for struct.make()
just like you suggested. Here's a snippit from the same documentation referenced above that confirms this:
Notes:
encode() cannot encode functions nor YAML Fragments. If you wish to make a struct that contains attributes that hold these types, consider make().
Fixed in vmware-tanzu/carvel#291.
Thanks again for the report @kieron-dev! 🙏🏻
Scope
Please fix the referenced documentation so that users are instructed to use
struct.make()
rather thanstruct.encode()
as the former is suitable for structs holding values of any type while the latter only holds primitives.Original report
What steps did you take: Along the lines of collection-of-functions in the docs, create a file like
What happened: When this is loaded, I see the error
What did you expect: No error
Anything else you would like to add: This occurs both using star and yml files. Also locally and in the playground.
Environment: ytt version 0.32.0 NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)"
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.