feat(protogen, BREAKING!): support protobuf editions and properly quote file option values#370
Open
feat(protogen, BREAKING!): support protobuf editions and properly quote file option values#370
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #370 +/- ##
==========================================
+ Coverage 73.91% 73.93% +0.01%
==========================================
Files 87 87
Lines 8664 8670 +6
==========================================
+ Hits 6404 6410 +6
Misses 1700 1700
Partials 560 560 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This MR adds support for Protobuf Editions in proto file generation, and changes how file-level option values are specified to give users full control over quoting.
Changes
Support protobuf edition
Editionfield toProtoOutputOption, allowing users to specify a protobuf edition (e.g.,"2023","2024").Editionis set, the generated.protofiles emitedition = "20XX";instead ofsyntax = "proto3";.features.utf8_validation(edition 2023) andfeatures.(pb.go).strip_enum_prefix(edition 2024).File option value quoting change (BREAKING CHANGE)
option <key= <value>;).go_packageshould now be specified as'"github.com/example/pkg"'instead ofgithub.com/example/pkg.features.utf8_validation = NONE) which require unquoted enum values.Tests
Test_bookExporter_exportwith table-driven test cases covering:proto3syntax modeedition = "2023"withfeatures.utf8_validationedition = "2024"withfeatures.(pb.go).strip_enum_prefixMigration Guide
Existing users must update their
fileOptionsconfiguration to include explicit quotes around string option values. For example: