()
| 49 | } |
| 50 | |
| 51 | func (a *Create) Validate() error { |
| 52 | if a.Id == "" { |
| 53 | return errors.New("id is null") |
| 54 | } |
| 55 | a.Path = fmt.Sprintf("/%s", strings.TrimPrefix(a.Path, "/")) |
| 56 | for _, method := range a.Methods { |
| 57 | if _, ok := validMethods[method]; !ok { |
| 58 | return fmt.Errorf("method(%s) is invalid", method) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | type Edit struct { |
| 66 | Name *string `json:"name"` |