Skip to main content

gotsrpc.yaml

Typically there will be one central gotsrpc.yaml file per project.

Purpose

Go code generation rules

  • service proxy generation
  • client generation

TypeScript code generation rules

  • file names for clients in Targets
  • file names for value object code generation Mappings

gotsrpc.yaml file sections

Targets

Think of targets as build targets. A target is defined for all services in a package

# define go module mode
module:
name: github.com/foomo/gotsrpc-playground/server
path: ./server

# build targets define for which interfaces code will be generated in a package
targets:

# the key of a target is arbitrary and solely serves readability
todos:
# map of service path => interface ie which service will be exposed on
# which path
services:
/services/todos: Service
# go package
package: github.com/foomo/gotsrpc-playground/server/services/todos

Mappings

package: github.com/foomo/gotsrpc-playground/server/services/playground
out: client/services/generated/client-playground.ts
tsrpc:
- Service

GOModule Support

To support go modules add


module:
name: github.com/foomo/gotsrpc
path: ../ # Relative Or Absolute Path where the package was checked out (root of the package)