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

[BUG] optional|required fields are no longer a thing in protobuf 3 #113

Closed
2 tasks done
smoya opened this issue Nov 22, 2024 · 2 comments
Closed
2 tasks done

[BUG] optional|required fields are no longer a thing in protobuf 3 #113

smoya opened this issue Nov 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@smoya
Copy link
Member

smoya commented Nov 22, 2024

Describe the bug.

The following is a protobuf3 valid message

message Example {
    string name = 1;
}

As you see, no need for adding optional or required (e.g. required string name = 1;) because such a concept is not present anymore in v3.

However, the parser fails with: illegal token 'string' unless I add optional or required keywords.

Expected behavior

required and optional keywords are not required (I don't even know if they are legal atm?)

Screenshots

How to Reproduce

  1. I first did this
  2. I then did this
  3. And so on . . .

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

@smoya smoya added the bug Something isn't working label Nov 22, 2024
@GreenRover
Copy link
Collaborator

This is expected behavior. When ever you not give a hint to the protobuf version. V2 will be assumed.

Please try:

syntax = "proto3";

message Example {
    string name = 1;
}

@smoya
Copy link
Member Author

smoya commented Nov 26, 2024

Makes sense. Thanks for the clarification!

@smoya smoya closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants