Skip to content

Commit 2502c26

Browse files
authored
fix: cannot force calls to products whose metadata is not entered (#191)
1 parent 0c19b37 commit 2502c26

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

openapi/commando.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ func (c *Commando) main(ctx *cli.Context, args []string) error {
7575
// rpc or restful call
7676
// aliyun <productCode> <method> --param1 value1
7777
product, _ := c.library.GetProduct(args[0])
78-
if version, _ := ctx.Flags().Get("version").GetValue(); version != "" {
79-
if style, ok := c.library.GetStyle(productName, version); ok {
80-
product.ApiStyle = style
81-
} else {
82-
return cli.NewErrorWithTip(fmt.Errorf("uncheked version %s", version),
83-
"Please contact the customer support to get more info about API version")
78+
if product.Code != "" {
79+
if version, _ := ctx.Flags().Get("version").GetValue(); version != "" {
80+
if style, ok := c.library.GetStyle(productName, version); ok {
81+
product.ApiStyle = style
82+
} else {
83+
return cli.NewErrorWithTip(fmt.Errorf("uncheked version %s", version),
84+
"Please contact the customer support to get more info about API version")
85+
}
8486
}
8587
}
8688
if product.ApiStyle == "restful" {

0 commit comments

Comments
 (0)