Kreya icon indicating copy to clipboard operation
Kreya copied to clipboard

Add support for buf modules (specifically protovalidate)

Open sammaxem opened this issue 5 months ago • 1 comments

Is your feature request related to a problem? Please describe. Recently, my team started using protovalidate. Usage of this validation library is as easy as including import "buf/validate/validate.proto";. The buf CLI tool will automatically resolve this import for you, and retrieve the validate file from the BSR.

Unfortunately, Kreya does not have builtin support for buf modules. So, when you try to import a gRPC collection which relies on protovalidate, it will throw this error:

Import "buf/validate/validate.proto" was not found or had errors.

Describe the solution you'd like Kreya can recognize some buf modules automatically, and resolve the missing import.

Describe alternatives you've considered You can solve this by inserting buf/validate/validate.proto into your local filesystem next to the folder containing the gRPC collection you want to import. However, this breaks the buf CLI due to conflict of the remote module and the local module:

Failure: buf/validate/validate.proto is contained in multiple modules:
  path: "."
  buf.build/bufbuild/protovalidate

Additional context I love this project for working with gRPC. I hope this can be implemented as buf has become the industry standard for working with protobuf.

Let me know if I could assist in the implementation.

sammaxem avatar Jul 23 '25 10:07 sammaxem

I can see the use case, but we will have to think about implementing this.

Just as a note, there are two other workarounds for you:

  • Generate file descriptor sets with buf and import that into Kreya: https://buf.build/docs/reference/descriptors/#generating-and-exchanging-descriptors. Given the right settings, this should include all dependencies into one file
  • Put the buf proto files into {Kreya installation path}/protoc/include, for example C:\Program Files\Kreya\protoc\include\buf\validate\validate.proto. This may not be optimal, as updates of Kreya may remove these files again

CommonGuy avatar Jul 23 '25 11:07 CommonGuy