tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.78k stars 489 forks source link

required field being deserialized as empty string #986

Open scullionw opened 6 months ago

scullionw commented 6 months ago

Is this expected? From what i understand, in proto2, if a field is marked as required then deserialization should fail if it is missing

Generated code (See required field)

Screenshot 2024-02-21 at 4 46 51 PM

Raw protoc decode (field is missing)

Screenshot 2024-02-21 at 4 45 17 PM

prost decoded struct (deserialization succeeded, empty string)

Screenshot 2024-02-21 at 4 48 42 PM

fwiw our nodejs protobuf library does fail on decode, but im wondering what the expected behaviour is