Skip to content

key:value set #593

Answered by HT154
Tightrope asked this question in Q&A
Discussion options

You must be logged in to vote

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's output.value:

things: Listing<Thing> = new {
  new {
    item1key1 = "string1"
    item1key2 = "string2"
  }
}

output {
  value = things
  renderer = new YamlRenderer {}
}

A couple things to note here:

  • output.value's default value here is module.
  • This example forces output.renderer to YamlRenderer as the default PcfRenderer only supports keyed objects at the top level (just like Pkl modules).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tightrope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants