If I declare the type base on string to use as enum type. Generator will identify its as Object, but its incorrect and would cursed Json Unmarshal failed during processing request. It should be smd.String.
type Category string
const (
CategoryLatest Category = "latest"
CategoryNews = "news"
)
func (s DataService) GetRecommendStreams(category Category) ([]string, error) {
}
...
GetRecommendStreams": {
Description: `TODO: deal with type problem,to made zenrpc support string enum or similar problem`,
Parameters: []smd.JSONSchema{
{
Name: "category",
Optional: false,
Description: ``,
Type: smd.Object, //<--- Problem here
Properties: map[string]smd.Property{},
},
},
Returns: smd.JSONSchema{
Description: ``,
Optional: false,
Type: smd.Array,
Items: map[string]string{
"type": smd.String,
},
},
},
...
If I declare the type base on string to use as enum type. Generator will identify its as Object, but its incorrect and would cursed Json Unmarshal failed during processing request. It should be
smd.String.