Skip to main content

Importers

Importers are used to fetch information about the available services and request/response types. You can add, edit and delete importers via Project → Importers.

info

Because fetching and parsing API definitions may take some time, Kreya caches the imported data. If you changed your API definitions, you may need to manually run the importers again (by clicking the icon in the main window).

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.

REST

To call REST APIs, using importers is optional. However, using an importer has a lot of advantages. For example, request contents are generated automatically.

Import via OpenAPI URL

To import an OpenAPI definition, the simplest way is to enter the URL of the OpenAPI specification. Both YAML and JSON formats are allowed.

Import via OpenAPI file

Should you have an OpenAPI file locally, simply choose the "REST OpenAPI file" importer type and select your file.

Kreya only stores the path to the OpenAPI file. If you intend to share your Kreya project, make sure that the path stays 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.

Generating operations automatically

For each importer, there is an option to create missing operations, which is enabled by default. When an importer runs, Kreya checks if any of the imported methods are missing in the project. This is useful if you want to keep your operations in sync with your API. If you add a method to your API, Kreya will automatically add an operation for it on the next importer run.