Skip to main content

gRPC

For gRPC, using importers is a must. Without importing the protobuf definitions, Kreya cannot know the available gRPC methods and the request/response types.

Import via gRPC server reflection

Some gRPC service support server reflection. Kreya can fetch all information directly from the service itself. If the gRPC service does not have a valid TLS certificate, you can disable the TLS (SSL) validation (this can be dangerous and impact security). TLS certificates for authentication purposes are also supported here.

Import via file descriptor sets

You can import your gRPC service and message definitions via proto file descriptor sets. These can be generated via protoc with the --include_imports --include_source_info --descriptor_set_out flags or via buf (read more about it here). Using file descriptor sets has the advantage that Kreya does not have to parse the protobuf files which will result in faster imports.

Kreya only stores the path to the file descriptor set files. If you intend to share your Kreya project, make sure that the paths stay correct. Kreya uses relative paths by default, but you may also use system environment variables like %APPDATA% or ${GOPATH}. They will work on any OS, regardless of the format.

Import via local protobuf files

You can add local protobuf files. Simply change the importer type to gRPC proto files and add your files.

If you have a complex directory structure with many files, use the Add proto directories button. All protobuf files found inside the chosen directory and subdirectories are automatically imported.

Kreya only stores the path to the protobuf files. If you intend to share your Kreya project, make sure that the paths stay correct. Kreya uses relative paths by default, but you may also use system environment variables like %APPDATA% or ${GOPATH}. They will work on any OS, regardless of the format.

Import paths

Protobuf files may import other protobuf files via relative paths. Consider the following example:

/src
/todo
todo.proto
/list
todo-list.proto (imports todo/todo.proto)

Here, the /src directory needs to be added as an import path, so that the relative path in todo-list.proto points to the correct file.

Kreya tries to guess the correct import paths. However, if you have a complex setup with multiple import paths, you may need to specify them manually.