kopium
                                
                                
                                
                                    kopium copied to clipboard
                            
                            
                            
                        handle default field
Problem
Some schemas can set explicit default: replace to define what defaults are, but we will always just output #[serde(default)] on non-required properties.
Solution
Add an OutputImpls struct and collect things like impl Default for MemberStruct that will ensure #[serde(default)] works and takes into account the correct default values. This is especially important for enums where no default can be derived.
EDIT: This must also handle enums.
We actually won't need to impl Default for SomeEnum for enums because of the rust 1.62 feature allowing us to do:
#[derive(Default)]
enum Maybe<T> {
    #[default]
    Nothing,
    Something(T),
}
i.e. we just need pushing "#[default]" to the m.extra_annot vec