zenrpc icon indicating copy to clipboard operation
zenrpc copied to clipboard

Write SMD schema to file

Open cv21 opened this issue 4 years ago • 1 comments

It is a bit inconvenient to expose SMD schema only as an http endpoint.

For example, you might have other tools that work with SMD schema and you could not use them automatically with zenrpc without SMD schema in a file.

cv21 avatar Aug 27 '19 08:08 cv21

Its can done manually ,I implemented a cli subcmd to generate the smd file manaually though cobra for ci usage

simplified version

rpc := zenrpc.NewServer(zenrpc.Options{ExposeSMD: true})
rpc.Register("user", UserService{})
rpc.Register("data", DataService{})
data, err := json.MarshalIndent(rpcServer.SMD(), "", "\t")
if err != nil {
	panic(err)
	return
}
err = ioutil.WriteFile("smd.json", data, 0644)
if err != nil {
	panic(err)
	return
}

LaysDragon avatar Apr 08 '21 10:04 LaysDragon