Support proto2 syntax and custom proto file headers#1305
Open
jwils wants to merge 1 commit into
Open
Conversation
`proto_schema_artifacts` gains two options: - `syntax: :proto2` emits a proto2 file instead of the default proto3 (labeling every field `optional` or `repeated`). This is useful when the generated messages need to reference proto2 types — `protoc` forbids a proto3 message from referencing a proto2 enum. - `headers:` injects file-level lines (such as `option` declarations) verbatim as a contiguous section after the `package` declaration, so language-specific options can be set without baking any particular convention into the gem.
67b8198 to
f62a859
Compare
995e2fd to
9b72525
Compare
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.
Why
Some consumers need the generated messages to reference proto2 types —
protocforbids a proto3 message from referencing a proto2 enum — and language-specific file options (likejava_package) shouldn't require baking any convention into the gem.What
proto_schema_artifactsgains two options:syntax: :proto2emits a proto2 file instead of the default proto3, labeling every fieldoptionalorrepeatedheaders:injects file-level lines (such asoptiondeclarations) verbatim as a contiguous section after thepackagedeclarationRisk Assessment
Low — only affects the unreleased
elasticgraph-proto_ingestionextension; both options are opt-in.References