protogen: Treat bytes field as non-nullable #123
No reviewers
TrueCloudLab/storage-core-developers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-api-go#123
Loading…
Reference in a new issue
No description provided.
Delete branch "fyrchik/frostfs-api-go:fix-optional-bytes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In protobuf 3.12 they have added an support for
optional
keyword,which has made it into the main branch in 3.15.
https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md
https://github.com/protocolbuffers/protobuf/blob/v3.12.0/docs/field_presence.md#presence-in-proto3-apis
This means that without an explicit
optional
keyword field presencefor scalars is not tracked, thus empty string in JSON should be
unmarshaled to a nil byte slice. Relevant decoding code and tests from
protojson:
fb995f184a/internal/impl/message_reflect_field.go (L327)
fb995f184a/encoding/protojson/decode_test.go (L134)
fb995f184a/encoding/protojson/decode_test.go (L156)
We do not support
optional
keyword and the generator will fail if it sees on.So only implement the default behaviour.
Refs #122
Signed-off-by: Evgenii Stratonikov e.stratonikov@yadro.com
7aebd82a84
tofdf56fabe5
84060ce16a
tobba4af93d6
New commits pushed, approval review dismissed automatically according to repository settings
bba4af93d6
tof0fc40e116
Whitespace changes only.