cosmos-proto icon indicating copy to clipboard operation
cosmos-proto copied to clipboard

Support optional fields

Open fdymylja opened this issue 4 years ago • 6 comments

The plugin currently does not support optional fields:

testpb/1.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-go-fasteflection hasn't been updated to support optional fields in proto3.

fdymylja avatar Jul 22 '21 15:07 fdymylja

it works in the main branch, but you need to pass --experimental_allow_proto3_optional

technicallyty avatar Jul 27 '21 16:07 technicallyty

iceboxing this as we are not planning to support optional fields at this time

technicallyty avatar Sep 08 '21 15:09 technicallyty

I think it's worth reopening this as I'm seeing some use cases for optional fields. How hard do you think it will be to add?

aaronc avatar Jan 25 '22 16:01 aaronc

Btw, pulsar codegen does not fail for me and generates the expected *int32 pointer type. But build does fail:

regen/ecocredit/curation/v1beta1/state.pulsar.go:662:6: x.XMin undefined (type *fastReflection_NumericAttributeDefinition has no field or method XMin)
regen/ecocredit/curation/v1beta1/state.pulsar.go:663:16: x.XMin undefined (type *fastReflection_NumericAttributeDefinition has no field or method XMin)
regen/ecocredit/curation/v1beta1/state.pulsar.go:664:9: undefined: NumericAttributeDefinition_Min

aaronc avatar Jan 25 '22 16:01 aaronc

It's complex due to presence semantics.

I will add it to the backlog, what is the priority?

fdymylja avatar Jan 25 '22 16:01 fdymylja

I would consider it low as I can make a work-around

aaronc avatar Jan 25 '22 16:01 aaronc