1// Code generated by go-swagger; DO NOT EDIT. 2 3// Copyright Prometheus Team 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package models 18 19// This file was generated by the swagger tool. 20// Editing this file might prove futile when you re-run the swagger generate command 21 22import ( 23 "strconv" 24 25 "github.com/go-openapi/errors" 26 "github.com/go-openapi/strfmt" 27 "github.com/go-openapi/swag" 28 "github.com/go-openapi/validate" 29) 30 31// Matchers matchers 32// 33// swagger:model matchers 34type Matchers []*Matcher 35 36// Validate validates this matchers 37func (m Matchers) Validate(formats strfmt.Registry) error { 38 var res []error 39 40 iMatchersSize := int64(len(m)) 41 42 if err := validate.MinItems("", "body", iMatchersSize, 1); err != nil { 43 return err 44 } 45 46 for i := 0; i < len(m); i++ { 47 if swag.IsZero(m[i]) { // not required 48 continue 49 } 50 51 if m[i] != nil { 52 if err := m[i].Validate(formats); err != nil { 53 if ve, ok := err.(*errors.Validation); ok { 54 return ve.ValidateName(strconv.Itoa(i)) 55 } 56 return err 57 } 58 } 59 60 } 61 62 if len(res) > 0 { 63 return errors.CompositeValidationError(res...) 64 } 65 return nil 66} 67