coreos / ignition-config-rs

Data structures for reading/writing Ignition configs
https://crates.io/crates/ignition-config
Apache License 2.0
3 stars 5 forks source link

Always derive `Default` #14

Closed bgilbert closed 2 years ago

bgilbert commented 2 years ago

If a struct derives Serialize but not Default, which schemafy does when a struct contains a required field, inject a derive for Default. This allows using Ignition config structs without manually specifying all the fields, but it also generates defaults for mandatory fields. Generating explicit new() methods would be better, but also more work.

I'm on the fence about this one. It makes using the structs more ergonomic, but in a way that isn't fully idiomatic.

bgilbert commented 2 years ago

It turns out that it's not too hard to generate new() associated functions, so I went ahead and did that in #16. Closing this out. Thanks for the discussion!