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] Write required string fields into the buffer when using Object API #8402

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

razvanalex
Copy link
Contributor

In C++, CreateX allows to write the default "" value of a required string, when the string is not explicitly set (i.e., here). 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 commit partially reverts #7719 when the string field is required. It also affects string fields marked as key, which are considered required (i.e., here).

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.
The Monster schema contains a key string field. For historical
convenience reasons, string keys are assumed required.
@github-actions github-actions bot added c++ codegen Involving generating code from schema golang labels Sep 24, 2024
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.

1 participant