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

[Go] Perform empty string check on string fields when packing objects #7719

Merged
merged 2 commits into from
Dec 22, 2022

Conversation

le-michael
Copy link
Collaborator

Fixes #7709

@github-actions github-actions bot added c++ codegen Involving generating code from schema golang labels Dec 18, 2022
@le-michael le-michael changed the title [Go] Perform nil check on string fields when packing object api [Go] Perform empty string check on string fields when packing objects Dec 18, 2022
@dbaileychess dbaileychess enabled auto-merge (squash) December 22, 2022 20:21
@dbaileychess dbaileychess merged commit 96d438d into google:master Dec 22, 2022
sunwen18 pushed a commit to sunwen18/flatbuffers that referenced this pull request Dec 25, 2022
Co-authored-by: Derek Bailey <derekbailey@google.com>
razvanalex added a commit to razvanalex/flatbuffers that referenced this pull request Sep 23, 2024
In C++, CreateX allows to write the default "" value of a required
string, when the string is not explicitly set. Object API Pack method
uses this implementation of CreateX.

However, in go, despite whether the field is optional or required, it is
always checked against empty string allowing to create messages that
fail to pass the verifier. This commits partially reverts
flatbuffers/google#7719 when the string field is required.
razvanalex added a commit to razvanalex/flatbuffers that referenced this pull request Sep 24, 2024
In C++, CreateX allows to write the default "" value of a required
string, when the string is not explicitly set. Object API Pack method
uses this implementation of CreateX.

However, in go, despite whether the field is optional or required, it is
always checked against empty string allowing to create messages that
fail to pass the verifier. This commits partially reverts google#7719 when the
string field is required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ codegen Involving generating code from schema golang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Go] Object API encodes empty strings
2 participants