What does singular mean in ProtoBuf >=3.15?

閲覧: 174 回
最初の未読メッセージにスキップ

Michael Vodep

未読、
2022/12/05 6:22:482022/12/05
To: Protocol Buffers
Hi

I have done now some research: singular seem to be fields, that have no addition field rules (like optional, repeated, map). There is no presence indication. 

BUT: The docu says:
"a well-formed message can have zero or one of this field (but not more than one)"

What does that mean? Are this wrapper messages with 1 field meant? https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/wrappers.proto

Thanks a lot
Michael


Marc Gravell

未読、
2022/12/07 5:12:152022/12/07
To: Michael Vodep、Protocol Buffers
An 'optional' field is still singular (optional having been re-added to proto3 relatively recently); singular just means: not 'repeated'

With regards to "wrappers.proto": all of the inner values in the wrapper types are singular; as stated in the text part of wrappers.proto, it isn't intended to use "repeated" with wrappers types, as the field presence doesn't align perfectly in that case. But ultimately, that's mostly up to your usage.

Marc

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/7743f999-de53-4861-b82b-3779a400e900n%40googlegroups.com.


--
Regards,

Marc

Marc Gravell

未読、
2022/12/07 5:13:052022/12/07
To: Michael Vodep、Protocol Buffers
(oh, and not "map"; "map" is just a specialized example of the semantics from "repeated", under the hood)
--
Regards,

Marc
全員に返信
投稿者に返信
転送
新着メール 0 件