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

Follow best practices for proto files #8

Open
LukBed opened this issue Aug 14, 2023 · 0 comments
Open

Follow best practices for proto files #8

LukBed opened this issue Aug 14, 2023 · 0 comments

Comments

@LukBed
Copy link
Collaborator

LukBed commented Aug 14, 2023

Proto files for gRPC API can be improved to follow best practices. The simplest wat to do it is to use Buf tool.

Example of use:

buf build           // check that proto compiles
buf format -w.      // format proto files
buf lint            // lint proto files

Current warnings from vss-vanilla module:

protobuf/password.proto:3:1:Files with package "com.virtuslab.vss.proto" must be within a directory "com/virtuslab/vss/proto" relative to root but were in directory "protobuf".
protobuf/password.proto:3:1:Package name "com.virtuslab.vss.proto" should be suffixed with a correctly formed version, such as "com.virtuslab.vss.proto.v1".
protobuf/password.proto:6:10:Field name "hashType" should be lower_snake_case, such as "hash_type".
protobuf/password.proto:11:10:Field name "hashType" should be lower_snake_case, such as "hash_type".
protobuf/password.proto:17:21:RPC request type "HashPasswordMessage" should be named "HashPasswordRequest" or "HashPasswordServiceHashPasswordRequest".
protobuf/password.proto:17:51:RPC response type "HashedPasswordMessage" should be named "HashPasswordResponse" or "HashPasswordServiceHashPasswordResponse".

Another issue is to decide if we need separate proto files for each module (vanilla, ZIO, Cats). I believe API should be the same for all modules, so the simplest solution would be to put proto into the commons module (as it's done for Tapir endpoints definitions).

The next step could be use Buf linter in builds.

FYI: @liosedhel

@LukBed LukBed changed the title Follow best practices in proto files Follow best practices for proto files Aug 14, 2023
@LukBed LukBed mentioned this issue Aug 14, 2023
Merged
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

No branches or pull requests

1 participant