Closed HKalbasi closed 1 year ago
I don't think that would be in scope for this project. However I think it should be possible to implement using the public API of MessageDescriptor - that's what is used for JSON serialization internally
Thanks for quick response. I will try to implement it using MessageDescriptor
and publish it as a separate crate.
I looked at the api and wonder why ReflectMessage::descriptor
needs &self
? Isn't it something that could be derived from the type itself?
It needs &self
so it can be implemented for DynamicMessage
. All message types generated by prost-build
should have a cheap Default
implementation, so its possible to get the descriptor from the type by doing T::default().descriptor()
Similar to how schemars generates json schemas from Rust structs. It seems unlike
prost::Message
, theReflectMessage
crate has the necessary ingredients for implementing such a feature. Do you think it is possible? And if so, do you consider it in scope for this project?