fixes for 5aad4b6dc90e
This commit is contained in:
parent
eab781794e
commit
7951e09238
18
config.go
18
config.go
@ -26,13 +26,19 @@ type InputParam struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
func (ip *InputParam) JSONUnmarshal(b []byte) error {
|
||||
if b[0] == '"' {
|
||||
func (ip *InputParam) UnmarshalJSON(b []byte) error {
|
||||
switch b[0] {
|
||||
case '"':
|
||||
ip.Description = ""
|
||||
ip.ParamType = PARAMTYPE_CONST
|
||||
return json.Unmarshal(b, &ip.Value)
|
||||
tmp := ""
|
||||
err := json.Unmarshal(b, &tmp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ip.Value = tmp
|
||||
|
||||
} else if b[0] == '{' {
|
||||
case '{':
|
||||
read := struct {
|
||||
Description string `json:",omitempty"`
|
||||
ParamType ParamType
|
||||
@ -45,9 +51,11 @@ func (ip *InputParam) JSONUnmarshal(b []byte) error {
|
||||
*ip = read
|
||||
return nil
|
||||
|
||||
} else {
|
||||
default:
|
||||
return errors.New("Malformed InputParam")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type CommandConfig struct {
|
||||
|
Loading…
Reference in New Issue
Block a user