criccomini / proto-schema-parser

A Pure Python Protobuf Parser
MIT License
38 stars 20 forks source link

Allow optional semicolon termination on block method declarations #24

Closed joshuaghezzi closed 6 months ago

joshuaghezzi commented 6 months ago
criccomini commented 6 months ago

I don't believe that trailing semicolons on blocks are valid Protobuf syntax.

From GPT4:

Screenshot 2024-04-16 at 9 39 53 AM

From the Buf proto language spec:

Block declarations: A block declaration is used for composite elements: those that may contain other elements. Instead of ending with a semicolon, they end with a block enclosed in braces ({ and }). The contained elements are defined inside these braces.

This appears to apply for both proto2 and proto3. As such, I'm inclined to reject this PR.

joshuaghezzi commented 6 months ago

I would disagree with the GPT4 output, I believe they are valid optional syntax. At least in terms of being able to compile that is.

Unfortunately if this is not supported this package would be unusable for my use case as our proto method block declarations do end with a semicolon.

criccomini commented 6 months ago

What are you using to codegen from the protos? It's possible that Buf's spec is incorrect--it's not canonical. protoc is canonical.

joshuaghezzi commented 6 months ago

Yeah seems like it could be the case. Just using protoc to generate source code.

criccomini commented 6 months ago

Ok, let's merge it. Unfortunately, there's a merge conflict. Can you rebase for me?

criccomini commented 6 months ago

Merged and released in 1.3.2!

https://pypi.org/project/proto-schema-parser/1.3.2/

criccomini commented 6 months ago

Thanks ❤️