Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write SMD schema to file #40

Open
cv21 opened this issue Aug 27, 2019 · 1 comment
Open

Write SMD schema to file #40

cv21 opened this issue Aug 27, 2019 · 1 comment
Labels

Comments

@cv21
Copy link

cv21 commented Aug 27, 2019

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.

@LaysDragon
Copy link

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants