`to_dict` does not contain default values
rejuvyesh opened this issue · comments
As the title says:
julia> @option mutable struct OptA; a::Int=1; end
julia> @option mutable struct OptB; b::OptA=OptA(); end
julia> opt = OptB();
julia> to_dict(opt)
OrderedCollections.OrderedDict{String,Any}()
Because of this reason, there is no easy way to just dump the default values for a config.
Hi this is intentional, I don't see any use case that requires the default value to exists in the configuration file/dict, leaving a field empty means using the default value already.
If you want to do the reflection of default values, consider field_defaults
or field_default
function for default value reflection.
I‘m closing this, feel free to open other issues if this is still a problem.