Skip to content

Support proto2 syntax and custom proto file headers#1305

Open
jwils wants to merge 1 commit into
joshuaw/proto-field-numbersfrom
joshuaw/proto-syntax-headers
Open

Support proto2 syntax and custom proto file headers#1305
jwils wants to merge 1 commit into
joshuaw/proto-field-numbersfrom
joshuaw/proto-syntax-headers

Conversation

@jwils

@jwils jwils commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Why

Some consumers need the generated messages to reference proto2 types — protoc forbids a proto3 message from referencing a proto2 enum — and language-specific file options (like java_package) shouldn't require baking any convention into the gem.

What

proto_schema_artifacts gains two options:

  • syntax: :proto2 emits a proto2 file instead of the default proto3, labeling every field optional or repeated
  • headers: injects file-level lines (such as option declarations) verbatim as a contiguous section after the package declaration

Risk Assessment

Low — only affects the unreleased elasticgraph-proto_ingestion extension; both options are opt-in.

References

`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.
@jwils jwils force-pushed the joshuaw/proto-field-numbers branch from 67b8198 to f62a859 Compare July 8, 2026 23:40
@jwils jwils force-pushed the joshuaw/proto-syntax-headers branch from 995e2fd to 9b72525 Compare July 8, 2026 23:40
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