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

Allow edition parsing #2998

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

oldergod
Copy link
Member

@oldergod oldergod commented Jun 20, 2024

defaulting to proto2 behavior, which is kinda wrong.

The way we break the world for Java callers is very sad...
Maybe we could just manually increate the enum values one bye one each year...

@oldergod oldergod force-pushed the bquenaudon.2024-06-20.editionparsing branch from d7c397b to 7da5c16 Compare June 20, 2024 11:59
@oldergod oldergod force-pushed the bquenaudon.2024-06-20.editionparsing branch from fd94792 to a305de2 Compare June 21, 2024 12:22
PROTO_2("proto2"),
PROTO_3("proto3"),
;
/** Syntax and edition version. */
Copy link
Member

Choose a reason for hiding this comment

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

It has nothing to do with your PR, but I just completely hate this design decision in protobuf. What a disaster for authors and readers of protobuf.

PROTO_3("proto3"),
;
/** Syntax and edition version. */
sealed class Syntax(internal val string: String) {
Copy link
Member

Choose a reason for hiding this comment

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

I’m tempted to say we create a new thing, Syntax2 or something, that offers these things, and keep Syntax as-is? Making a big binary-incompatible change to wire-runtime has a potentially large user impact?

(Why is Syntax in the runtime API?)

// Created for backward capability with when Syntax used to be an enum.
fun name(): String {
return when (this) {
// TODO(Benoit) Edition needs to return something like `Edition(<value>)`.
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, yuck. Anything calling this might not be able to parse it later

}

@Test
fun rejectUnknownEditions() {
Copy link
Member

Choose a reason for hiding this comment

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

Love these tests

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.

None yet

2 participants