Skip to content

Conversation

@copybara-service
Copy link

Support more chars in type URLs in the C++ text-format parser.

Change the C++ text-format parser to allow for more characters and formats
in the type URL prefixes of expanded Any protos. This follows a recent
change to the text-format spec which we are now closely following [1,2].

Note: This change modifies the default implementation of the Finder interface by removing this special treatment of non-standard type URLs. Any protos with type URL prefixes that are not type.googleapis.com/ or type.googleprod.com/ won't be treated specially anymore when converting to or from textproto using the default settings (for example, when using TextFormat::PrintToString() or TextFormat::ParseFromString()). In particular, Any protos with a non-standard type URL prefix will now get expanded by default when printed to textproto with the SetExpandAny() option enabled.

Refs:

Change the C++ text-format parser to allow for more characters and formats
in the type URL prefixes of expanded Any protos. This follows a recent
change to the text-format spec which we are now closely following [1,2].

Note: This change modifies the default implementation of the `Finder` interface by removing [this special treatment](https://github.com/protocolbuffers/protobuf/blob/135bec4ee8c7cb8f9f8f2d5723bda5005948fa69/src/google/protobuf/text_format.cc#L255-L258) of non-standard type URLs. Any protos with type URL prefixes that are not `type.googleapis.com/` or `type.googleprod.com/` won't be treated specially anymore when converting to or from textproto using the default settings (for example, when using `TextFormat::PrintToString()` or `TextFormat::ParseFromString()`). In particular, Any protos with a non-standard type URL prefix will now get expanded by default when printed to textproto with the [`SetExpandAny()`](https://github.com/protocolbuffers/protobuf/blob/135bec4ee8c7cb8f9f8f2d5723bda5005948fa69/src/google/protobuf/text_format.h#L406) option enabled.

Refs:
- [1] https://protobuf.dev/reference/protobuf/textformat-spec/#characters
- [2] https://protobuf.dev/reference/protobuf/textformat-spec/#field-
PiperOrigin-RevId: 844790397
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.

1 participant