Skip to content

Support proto2 syntax and custom proto file headers - #1305

Merged
jwils merged 1 commit into
mainfrom
joshuaw/proto-syntax-headers
Aug 19, 2026
Merged

Support proto2 syntax and custom proto file headers#1305
jwils merged 1 commit into
mainfrom
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

Update — 2026-07-10

This PR is stacked directly on #1306 (→ #1304#1080).

@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch 2 times, most recently from 9b72525 to 3396a37 Compare July 9, 2026 16:00
@jwils
jwils changed the base branch from joshuaw/proto-field-numbers to joshuaw/proto-timestamp July 9, 2026 16:00
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 3396a37 to 98fac03 Compare July 9, 2026 17:29
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 98fac03 to b3029f8 Compare July 9, 2026 18:13
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from b3029f8 to d837b3a Compare July 10, 2026 15:44
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from d837b3a to 6f1b1b1 Compare July 10, 2026 15:52
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 6f1b1b1 to d4471ca Compare July 11, 2026 13:38
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from d4471ca to 5eb990f Compare July 11, 2026 13:54
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch 2 times, most recently from d40ff2e to 40be848 Compare July 11, 2026 14:14
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 7b9a2b7 to c8b5e5e Compare July 15, 2026 23:52
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 0f21d16 to abf4228 Compare July 31, 2026 13:31
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from abf4228 to dedef1c Compare August 3, 2026 15:52
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from dedef1c to a308ae9 Compare August 3, 2026 15:57
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from a308ae9 to 3fb6c6c Compare August 6, 2026 15:54
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 3fb6c6c to 138589f Compare August 7, 2026 16:20
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from 138589f to cf44426 Compare August 8, 2026 17:44
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from cf44426 to b202b68 Compare August 8, 2026 17:59
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from b202b68 to 29a1a50 Compare August 8, 2026 18:57
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch 2 times, most recently from 109b80d to a85103d Compare August 16, 2026 01:56

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple non-blocking suggestions.

Comment thread elasticgraph-proto_ingestion/README.md Outdated
Comment thread elasticgraph-proto_ingestion/README.md Outdated
@jwils
jwils force-pushed the joshuaw/proto-syntax-headers branch from a85103d to 4605421 Compare August 18, 2026 14:49
Base automatically changed from joshuaw/proto-timestamp to main August 19, 2026 02:17
`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.
- `header_lines:` 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-syntax-headers branch from 4605421 to 6805286 Compare August 19, 2026 02:17
@jwils
jwils merged commit e7c67a0 into main Aug 19, 2026
22 checks passed
@jwils
jwils deleted the joshuaw/proto-syntax-headers branch August 19, 2026 02:42
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.

2 participants