-
I have run into an issue where I'm generating code for some kubernetes deployment that uses datadog integration for creating datadog monitors. It has a requirement that some values are quoted as string even though they are numbers. So when I try to deploy I get errors from kubernetes like:
I did try the various compat modes in
But that leads to the tag being inside a string, like:
instead of:
Will I have to do post some custom post processing of generated YAML to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The solution here is actually extremely straightforward: If a value is a String in Pkl it will be a string in the resulting YAML! If all keys under renderer = new YamlRenderer {
converters {
["options.thresholds.*"] = (v) -> v.toString()
}
} Pkl's YAML renderer knows when to wrap a string value in quotes to avoid a collision with other YAML types (number, boolean, etc.). This is also why the attempt to add |
Beta Was this translation helpful? Give feedback.
The solution here is actually extremely straightforward: If a value is a String in Pkl it will be a string in the resulting YAML!
If all keys under
options.thresholds
should have string values, then you want this:Pkl's YAML renderer knows when to wrap a string value in quotes to avoid a collision with other YAML types (number, boolean, etc.). This is also why the attempt to add
!!str
results in a quoted string.