Skip to main content

generateProto

@webda/grpc


Function: generateProto()

generateProto(operations, schemas, packageName?): string

Defined in: grpc/src/proto-generator.ts:14

Generate a .proto file from registered operations and their schemas.

Groups operations by prefix (e.g., "Post.Create" → service PostService) and converts JSON Schema input/output types to protobuf messages.

Parameters​

operations​

Record<string, Omit<OperationDefinition, "service" | "method">>

map of operation IDs to their definitions

schemas​

Record<string, JSONSchema7>

all known JSON schemas keyed by schema reference name

packageName?​

string = "webda"

protobuf package name to use in the generated file

Returns​

string

the complete .proto file content as a string