Open rellfy opened 1 month ago
To clarify, I am currently setting all these values dynamically, without using the generated Reserved
struct. But it would be much nicer to be able to use the generated struct as it is significantly less code to set all the fields.
The scenario I am working with is that clients may upload a dynamic proto file, which may follow a specific schema of reserved fields that is generated on the server.
Therefore, if the dynamic client-uploaded schema contains a reserved field name, the server creates it using the generated field from the static server files (which defines the reserved fields). For example, let's say that the message
Reserved
and field namereserved
are reserved as a special field. Assume the dynamic client message isClientMessage
:on the server something like this happens:
This panics on
protobuf/src/reflect/dynamic/optional.rs
line 29:I believe it panics because one message is generated while the other is dynamic, but since the schema matches it should not panic IMO.
So my question would be, is there a way to be able to use a generated type to apply to
set_singular_field
on a dynamic field? Maybe serializing the generated type and de-serializing as the dynamic would work, but this seems an inefficient way to do it.If I simply comment out the
assert_eq
above and link the package locally, it works fine.My first thought to address this would be to replace the
assert_eq
, or the equality implementation for the types, with something that checks the underlying schema only.