Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "Protobuf Editions" #468

Closed
agrue opened this issue Apr 22, 2024 · 1 comment · Fixed by #479
Closed

Support "Protobuf Editions" #468

agrue opened this issue Apr 22, 2024 · 1 comment · Fixed by #479

Comments

@agrue
Copy link
Contributor

agrue commented Apr 22, 2024

Protobuf Editions overview: https://protobuf.dev/editions/overview/

This feature introduces a new syntax (e.g. edition = "2023";) that currently breaks proto-lens. It crashes in this partial function here:

s -> error $ "Unknown syntax type " ++ show s

The error is Unknown syntax type "editions".

@chungyc
Copy link
Member

chungyc commented Sep 10, 2024

I have looked at this sufficiently closely by now that I know what needs to be done.

  1. Update the bootstrapping generated code for the protocol buffer message types used by protoc plugins to a recent version, so that it includes the fields necessary to support Protobuf Editions. The update will not affect current behavior. This will be handled by this pull request: Catch up on changes in protobuf up to v28.0. #469

  2. Update the code generator to tell protoc that it can support Protobuf Editions, which a subsequent change can do: Accept hypothetical Protobuf Editions files. #470

    Depending on the preference of the reviewers, I can modify this change to say it only supports EDITION_LEGACY, which would allow us to merge in code partially supporting Protobuf Editions early without allowing it to process Protobuf Editions files before the support is complete. Or I can make all the changes (i.e, including the subsequent steps) to support Protobuf Editions in a single much larger pull request.

  3. Implement feature resolution for Protobuf Editions. This can be done with this change: Support feature resolution for Protobuf Editions. #473

  4. Plumb through Protobuf Editions feature sets throughout the code generator, replacing adjustments based on syntax type with those based on feature sets. We would basically replace SyntaxType with feature sets. This can be done with this change: Use per-edition feature defaults instead of syntax type to control behavior. #477

  5. Override features overridden in enclosed scopes. This can be done with this change: Override features defined in enclosed scopes. #479

These changes to the protoc plugin should be all that is necessary to support Protobuf Editions 2023, as it is limited to being a stepping stone from proto2 and proto3 to Protobuf Editions instead of adding any new functionality.

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 a pull request may close this issue.

2 participants