key:value set
#593
-
I am trying to write a simple key:value set in Pkl and output to yaml. Expected .yaml output:
How do I define the above in Pkl where the output does not contain a key for the Set itself. The above output is exactly what I want. |
Beta Was this translation helpful? Give feedback.
Answered by
HT154
Jul 21, 2024
Replies: 1 comment
-
As you've noticed, Pkl cannot represent things: Listing<Thing> = new {
new {
item1key1 = "string1"
item1key2 = "string2"
}
}
output {
value = things
renderer = new YamlRenderer {}
} A couple things to note here:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Tightrope
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you've noticed, Pkl cannot represent
Listing
values (or any other collection) at the module top-level. In these cases, the recommended practice is to override the module'soutput.value
:A couple things to note here:
output.value
's default value here ismodule
.output.renderer
toYamlRenderer
as the defaultPcfRenderer
only supports keyed objects at the top level (just like Pkl modules).