func (m *Order) validateQuantityEnum(path, location string, value int32) error { if orderQuantityEnum == nil { var res []int32 if err := json.Unmarshal([]byte(`[1,2,3]`), &res); err != nil { return err } for _, v := range res { orderQuantityEnum = append(orderQuantityEnum, v) } } if err := validate.Enum(path, location, value, orderQuantityEnum); err != nil { return err } return nil }
func (m *Order) validateStatusEnum(path, location string, value string) error { if orderStatusEnum == nil { var res []string if err := json.Unmarshal([]byte(`["suspend","shipment","received"]`), &res); err != nil { return err } for _, v := range res { orderStatusEnum = append(orderStatusEnum, v) } } if err := validate.Enum(path, location, value, orderStatusEnum); err != nil { return err } return nil }