forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
protobuf: Normalize protobuf message names (MaterializeInc#9385)
Create new wrapper struct `NormalizedProtobufMessageName` that ensures protobuf message names have a leading dot. ### Motivation The rust protoc library will panic if message names don't have a leading dot. This is fixed in MaterializeInc#9381 but I think we can do better by ensuring the message names are properly formatted right at the source. I think this approach is an improvement because: 1. We're encoding the information that these strings have an extra constraint into the type system. It's now impossible to create a `DecodedDescriptors` with a message name that doesn't have a leading dot. 2. We don't have to reason about when we need to normalize them (e.g. making sure we add a leading dot before passing to any external library). 3. The `NormalizedProtobufMessageName`s are created without throwing any errors so it isn't any trickier / painful to use than a `String`
- Loading branch information
Showing
4 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters