Skip to content

Is "composability" really a fundamental ytt limitation that jsonnet doesn't have? #392

Answered by pivotaljohn
pmorch asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @pmorch! Thank you for taking the time to detail the situation and make so clear your question. 🙏🏼

There are a number of angles I see in here. I think I can best contribute here by drawing up the levels of composability present in ytt and then we can step back and look at it, together.

Level 0: A Function

Within a given invocation of ytt, we can capture any size chunk of YAML, wrap it in a function and then invoke it (Docs: Language > YAML Fragment).

Attempting to translate from the jsonnet example you gave, we'd have:

template.yml

#@ load("@ytt:template", "template")

#! First, capture the YAML document in a "YAML Fragment"
#!
#@ def my_template(foo):
---
field1: #@ foo + "1"
field2: #

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@pivotaljohn
Comment options

@pivotaljohn
Comment options

@microwavables
Comment options

@pmorch
Comment options

@microwavables
Comment options

Answer selected by pmorch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants