Open Carter12s opened 2 years ago
serde_json should technically be able to generate these stubs without requiring a default I think?
You mean, serde_json would generate the default values for each field itself? Wouldn't that reinvent the wheel of the Default trait? The Default trait is intended for exactly this: a stub value of a given type
I'm working on a command line utility that takes json data payloads as an argument.
An incredibly convenient feature of this utility is to generate a "stub" json of the correct structure for the user to then fill with valid data.
Example:
I've achieved this functionality so far by requiring all structs that interact with this CLI to impl Default and passing their default value into serde_json to generate the stub.
I'm curious about the following: