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

V2: Clarify map behavior with message_encoding = DELIMITED #829

Merged
merged 1 commit into from
May 6, 2024

Conversation

timostamm
Copy link
Member

Map fields are syntactic sugar for a repeated message field with field 1 for key and field 2 for value.

In Edition 2023, a file option features.message_encoding = DELIMITED does not apply to this map entry message, and does not apply to the value field (which can be a message field).

This behavior was clarified in protocolbuffers/protobuf#16576 (specifically this line for the map entry and this line for the map value - both would be TYPE_GROUP with DELIMITED).

Our implementation already matched the behavior, this PR just adds additional test coverage.

Our implementation has just one property delimitedEncoding on map field descriptors that applies to both the map entry and map values. If a future edition changes the behavior, it is possible that we have to provide two distinct properties. IF necessary, we can expose the map entry message for this purpose, which will not be a breaking change.

@timostamm timostamm merged commit 4a77a4c into v2 May 6, 2024
7 checks passed
@timostamm timostamm deleted the tstamm/clarify-maps branch May 6, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants