Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Protobuf 3.15 optional fields #28

Open
kelteseth opened this issue Feb 15, 2022 · 0 comments
Open

Add support for Protobuf 3.15 optional fields #28

kelteseth opened this issue Feb 15, 2022 · 0 comments

Comments

@kelteseth
Copy link

kelteseth commented Feb 15, 2022

Protobuf 3.15 (Feb 18, 2021) introduced optional messages to know if a message value was set or not.

Example from: https://stackoverflow.com/a/62566052/12619313

syntax = "proto3";

message Foo {
    int32 bar = 1;
    optional int32 baz = 2;
}

A has_baz()/hasBaz() method is generated for the optional field above, just as it was in proto2.

This is useful for example if you want to display imported 3d OpenStreetMap data that only sometimes contains height data.

message Vec3 {
  float x = 1;
  optional float y = 2;  // Godot UP
  float z = 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant