zenrpc icon indicating copy to clipboard operation
zenrpc copied to clipboard

SMD: default value not parsed to SMD

Open smyrman opened this issue 5 years ago • 0 comments

Setting a default value through magic comments, e.g.:

//zenrpc:bar="bar" Foobar
func (srv Service) Foo(ctx contect.Context, foo string) (*Result, *zenrpc.Error) {
	// ...
}

Appear not too generate a Default value in the SMD:

{
	Name:        "foo",
	Optional:    true,
	Description: `Foobar`,
	Type:        smd.String,
},

Expect something ala:

_MfooAbar_defaultJSON, _ := json.Marshal("bar")
// ...
{
	Name:        "foo",
	Optional:    true,
	Description: `Foobar`,
	Type:        smd.String,
	Default:     json.RawMessage(_MfooAbar_defaultJSON),
},

zenrpc version v1.0.1

smyrman avatar Sep 11 '19 10:09 smyrman