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

Disallow ignorezero in Message field #259

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Disallow ignorezero in Message field #259

merged 1 commit into from
Jan 19, 2024

Conversation

mxi-box
Copy link
Contributor

@mxi-box mxi-box commented Jan 18, 2024

According to Application note: Field presence, a Singular Message field without optional adjective should also have Explicit Presence. Ignoring zero-length message field causes indistinguishable presence.

Copy link

sonarcloud bot commented Jan 18, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@starwing
Copy link
Owner

"Empty" length-delimited values (such as empty strings) can be validly represented in serialized values: the field is "present," in the sense that it appears in the wire format. However, if the generated API does not track presence, then these values may not be re-serialized; i.e., the empty field may be "not present" after a serialization round-trip.

It seems messages with all optional fields zeroed can be ignored in wired format. (in the docs your provided)

@coveralls
Copy link

Coverage Status

coverage: 99.61%. remained the same
when pulling 7791963 on mxi-box:master
into 3631ca6 on starwing:master.

@mxi-box
Copy link
Contributor Author

mxi-box commented Jan 18, 2024

"Empty" length-delimited values (such as empty strings) can be validly represented in serialized values: the field is "present," in the sense that it appears in the wire format. However, if the generated API does not track presence, then these values may not be re-serialized; i.e., the empty field may be "not present" after a serialization round-trip.

It seems messages with all optional fields zeroed can be ignored in wired format. (in the docs your provided)

if the generated API does not track presence, ...

Then the table Presence in proto3 APIs below writes that singular message's presence must be tracked regardless of optional

@starwing
Copy link
Owner

Okay, you are right. Merged.

@starwing starwing merged commit 2f05a21 into starwing:master Jan 19, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants