Closed cschiefe closed 1 year ago
Hey @cschiefe! The default value choice of nothing
was deliberate, the protobuf language guide has the following to say about default values:
[...] For message fields, the field is not set. Its exact value is language-dependent. See the generated code guide for details.
Nothing
is our way of saying that the field is "not set".
You should be able to get the type information using Julia reflection capabilities, e.g.:
julia> struct A
a::Int
b
end
julia> fieldnames(A)
(:a, :b)
julia> fieldtypes(A)
(Int64, Any)
Thanks - I'll go with that and de-unionize Union{Nothing, ColorPb} to get the info needed.
Hello, I'm porting some code to run with ProtoBuf.jl v 1.0.9 and ran into some trouble now that __protobuf_jl_internal_meta is gone. We need a way to get the expected types of each pb message's fields. The default_values() work quite well until we get to nested protobufs, such as the following:
It seems as though the default value of the Color field should == ColorPb(). Was this an oversight or perhaps there is another way to get the intended type of the Color field at runtime?