git.iko.soy/rowtype-yoga/purescript-protobuf
on master help sign in
WIP
commitb05ba4158749db7a4faa78d93466ad2fb0b5eeae authorJames Brock <jamesbrock@gmail.com> dateSat 3 Apr 2021, 21:53 (6 years ago) parentc6c8bb2
1 file changed+4
src/ProtocPlugin/Main.purs+4
src/ProtocPlugin/Main.purs+4
@@ -354,6 +354,10 @@ genFile proto_file (FileDescriptorProto
354354 Right $ Just $ " Runtime.putRepeated " <> show fnumber <> " r." <> fname <> " $ Runtime.putLenDel " <> mkFieldType "put" tname
355355 go FieldDescriptorProto_Label_LABEL_REPEATED FieldDescriptorProto_Type_TYPE_MESSAGE _ =
356356 Left "Failed genFieldPut missing FieldDescriptorProto type_name"
357+ -- Do we want to do message default checking? A message would be “default,” and would not be encoded on the wire,
358+ -- iff “all singular fields are unset and all repeated fields are empty.”
359+ -- https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message
360+ -- For now we just say `(const false)`, the message is never default.
357361 go _ FieldDescriptorProto_Type_TYPE_MESSAGE (Just tname) =
358362 Right $ Just $ " Runtime.putOptional " <> show fnumber <> " r." <> fname <> " (const false) $ Runtime.putLenDel " <> mkFieldType "put" tname
359363 go _ FieldDescriptorProto_Type_TYPE_MESSAGE _ =