oniksan / godobuf

A Google Protobuf implementation for Godot / GDScript
BSD 3-Clause "New" or "Revised" License
260 stars 36 forks source link

question about types, services, optional fields #13

Closed m6c7l closed 3 years ago

m6c7l commented 3 years ago

Hi there!

I like your idea of having a GDScript compiler for Godot. However, I need more advanced features of the Protocol Buffers for my use case, thus a few questions.

What is the reason for not supporting types, services, and optional fields? It is because of the complexity of marshaling or missing features in Godot? If so, what would be a reasonable approach and the next steps to implement support for them? Do you consider making a protoc plugin reasonable since that imho would be the regular way to go?

Thanks!

oniksan commented 3 years ago

Hi!

What is the reason for not supporting types, services, and optional fields? It is because of the complexity of marshaling or missing features in Godot?

  1. Optional fields are defined only in the specification proto2. In proto3, as far as I understand, they abandoned the optional fields. For proto2 Godobuf suppors optional fields.
  2. What "types" are you mean?
  3. Services assumes use of interfaces or something abstract constructions, in the GDScript they seem to be absent.

If so, what would be a reasonable approach and the next steps to implement support for them?

I do not plan to support services in the near future.

Do you consider making a protoc plugin reasonable since that imho would be the regular way to go?

It would be simpler and smarter, but not convenient to use. Godobuf is convenient, because built into IDE, does not require any additional software and does everything in one click.

m6c7l commented 3 years ago

Hi! As I was reading "Any types" under "Not supported" I mistakenly assumed you do not support defining any message type. But now I understand that you mean the "keyword" Any for Any-message types. Just a little bit of confusion on my side :-) Thanks!

oniksan commented 3 years ago

It would be strange not to support any types, then what to support at all :-)

Can I close the issue?

m6c7l commented 3 years ago

I agree. Yes.

kelteseth commented 2 years ago

Optional fields are defined only in the specification proto2. In proto3, as far as I understand, they abandoned the optional fields. For proto2 Godobuf suppors optional fields.

Protobuf 3.15 (Feb 18, 2021) introduced optional messages and I need that feature to know If my Vector coordinates are NULL or 0.0

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.

@oniksan should I create a new issue for this?

oniksan commented 2 years ago

Yes, please create new.

kelteseth commented 2 years ago

Cheers! https://github.com/oniksan/godobuf/issues/28