Replies: 2 comments 1 reply
-
| 
         You're looking for  Your test.pkl would then looks like this: module foo
bar: Bar;
class Bar {
        local count: UInt16 = 5;
        name: String;
} | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Generally, you'll want to make this a nullable property, and describe what it means if  Something like: class Bar {
  /// Etc etc what count does  
  ///
  /// Default if not set: `5`
  count: UInt16?
  name: String
}By default, the JSON renderer will omit null properties (see https://pkl-lang.org/package-docs/pkl/current/base/JsonRenderer.html#omitNullProperties). Here's an example of another module that uses this pattern: https://github.com/apple/pkl-pantry/blob/fa1f4ad2889e10570a734f8b3fd4a68407d0b563/packages/com.influxdata.telegraf/plugins/inputs/PrometheusInput.pkl#L97  | 
  
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Can it make it NOT emit the default count of 5 here?
Wanted:
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions