(b []byte)
| 61 | type StringOrArray []string |
| 62 | |
| 63 | func (s *StringOrArray) UnmarshalJSON(b []byte) error { |
| 64 | var str string |
| 65 | if err := json.Unmarshal(b, &str); err == nil { |
| 66 | *s = []string{str} |
| 67 | return nil |
| 68 | } |
| 69 | |
| 70 | var arr []string |
| 71 | if err := json.Unmarshal(b, &arr); err == nil { |
| 72 | *s = arr |
| 73 | return nil |
| 74 | } |
| 75 | |
| 76 | return errors.New("invalid string or array") |
| 77 | } |
| 78 | |
| 79 | type Option struct { |
| 80 | Type string `json:"type"` |
nothing calls this directly
no outgoing calls
no test coverage detected