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

Add support for protobuf editions #146

Closed
MaxProfit opened this issue Sep 25, 2024 · 3 comments
Closed

Add support for protobuf editions #146

MaxProfit opened this issue Sep 25, 2024 · 3 comments
Labels
Feature New feature or request

Comments

@MaxProfit
Copy link

Feature description:
Protobuf editions should be supported

Problem it solves or use case:
As it seems to be the next move for the protobuf syntax, this library should move to support the new syntax and changes. My current error is as follows.

Failure: plugin "buf.build/bufbuild/validate-go" does not support feature "supports editions" which is required by "my.proto"

Proposed implementation or solution:
Implement the changes as specified by the edition 2023 to start.

Contribution:
I might be able to take this on when I get some time, but I can definitely help others if they're willing to take it on in any way I can.

Examples or references:
N/A

Additional context:
Should be pretty self-explanatory, feel free to ping me if any questions

@MaxProfit MaxProfit added the Feature New feature or request label Sep 25, 2024
@jhump
Copy link
Member

jhump commented Sep 25, 2024

@MaxProfit, this repo does not have any proto plugins. The plugin you referenced is actually for this repo: https://github.com/bufbuild/protoc-gen-validate

Note that repo is deprecated. This repo is its replacement. This repo relies on runtime reflection, not code generation. And it does support Editions. We highly recommend upgrading.

When you upgrade, you can even leave the existing annotations in your protos and just include legacy support when you create a validator. Note however that the legacy support is purely transitional -- you should also update all of your proto sources to use the new custom options, but you can do that over time instead of having to do everything at once (or worse, have both annotations on everything for some period). We plan to eventually drop the legacy support, in a final v1.0 of this repo, so you'll need to migrate your options over (which should be mechanical and fairly painless) before you could upgrade to a future v1.0.

@rodaine
Copy link
Member

rodaine commented Sep 25, 2024

Adding onto @jhump's response about legacy support, protovalidate also has a migration utility that will perform the updates from PGV to protovalidate for you.

@MaxProfit
Copy link
Author

MaxProfit commented Sep 28, 2024

@jhump Ah that makes sense! Thank you! I'm even using protovalidate in my buf.gen.yaml so I must've just included this incorrectly!

@rodaine rodaine closed this as completed Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants