// Validate loads and validates a JSON schema
968240
func Validate(ls JSONLoader, ld JSONLoader) (*Result, error) {
	// load schema
	schema, err := NewSchema(ls)
	if err != nil {
		return nil, err
	}
	return schema.Validate(ld)
}
723508
func (*BooleanSchema) Validate(v reflect.Value) bool {
	return dereference(v).Kind() == reflect.Bool
}
1128547
func (s *SnapshotDeleteService) Validate() error {
	var invalid []string
	if s.repository == "" {
		invalid = append(invalid, "Repository")
	}
	if s.snapshot == "" {
		invalid = append(invalid, "Snapshot")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
1217156
func (d multiValidator) Validate(s interface{}) error {
	for _, validator := range d {
		if err := validator.Validate(s); err != nil {
			return err
		}
	}

	return nil
}
849694
func (i *I) Validate(ctx *Context) error {
	_, err := i.template(ctx)
	return err
}
958529
func (s *GetTemplateService) Validate() error {
	var invalid []string
	if s.id == "" {
		invalid = append(invalid, "Id")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
334850
func (c *Config) Validate() bool {
	if c.DBType == "sqlite3" {
		if ok, _ := valid.IsFilePath(c.DBPath); !ok {
			log.Errorf("SQLite3 DB path must be a *Absolute* file path. dbpath: %s", c.DBPath)
			return false
		}
	}

	if len(c.DumpPath) != 0 {
		if ok, _ := valid.IsFilePath(c.DumpPath); !ok {
			log.Errorf("JSON path must be a *Absolute* file path. dumppath: %s", c.DumpPath)
			return false
		}
	}

	_, err := valid.ValidateStruct(c)
	if err != nil {
		log.Errorf("error: " + err.Error())
		return false
	}
	return true
}
670345
func (v *DefaultValidator) Validate(ctx context.Context, in interface{}) (interface{}, error) {
	if in == nil {
		return in, nil
	}

	v.lazyinit()
	if err := v.validate.Struct(in); err != nil {
		return nil, err
	}

	return in, nil
}
343494
func (r *schemaValidatorType) validateSchema(schema, cfg string) []serror.SnapError {
	schemaLoader := gojsonschema.NewStringLoader(schema)
	testDoc := gojsonschema.NewStringLoader(cfg)
	result, err := gojsonschema.Validate(schemaLoader, testDoc)
	var serrors []serror.SnapError
	// Check for invalid json
	if err != nil {
		serrors = append(serrors, serror.New(err))
		return serrors
	}
	// check if result passes validation
	if result.Valid() {
		return nil
	}
	for _, err := range result.Errors() {
		serr := serror.New(errors.New("Validate schema error"))
		serr.SetFields(map[string]interface{}{
			"value":       err.Value(),
			"context":     err.Context().String("::"),
			"description": err.Description(),
		})
		serrors = append(serrors, serr)
	}
	return serrors
}
741598
func (d *FieldData) Validate() error {
	var result *multierror.Error

	// Scan for missing required fields
	for field, schema := range d.Schema {
		if schema.Required {
			_, ok := d.Raw[field]
			if !ok {
				result = multierror.Append(result, fmt.Errorf(
					"field %q is required", field))
			}
		}
	}

	// Validate field type and value
	for field, value := range d.Raw {
		schema, ok := d.Schema[field]
		if !ok {
			result = multierror.Append(result, fmt.Errorf(
				"%q is an invalid field", field))
			continue
		}

		switch schema.Type {
		case TypeBool, TypeInt, TypeMap, TypeArray, TypeString:
			val, _, err := d.getPrimitive(field, schema)
			if err != nil {
				result = multierror.Append(result, fmt.Errorf(
					"field %q with input %q doesn't seem to be of type %s",
					field, value, schema.Type))
			}
			// Check that we don't have an empty value for required fields
			if schema.Required && val == schema.Type.Zero() {
				result = multierror.Append(result, fmt.Errorf(
					"field %q is required, but no value was found", field))
			}
		default:
			result = multierror.Append(result, fmt.Errorf(
				"unknown field type %s for field %s", schema.Type, field))
		}
	}

	return result.ErrorOrNil()
}
622724
func (self *StructFieldDef) Validate() error {
	if self.Name == "" {
		return fmt.Errorf("StructFieldDef.name is missing but is a required field")
	} else {
		val := Validate(RdlSchema(), "Identifier", self.Name)
		if !val.Valid {
			return fmt.Errorf("StructFieldDef.name does not contain a valid Identifier (%v)", val.Error)
		}
	}
	if self.Type == "" {
		return fmt.Errorf("StructFieldDef.type is missing but is a required field")
	} else {
		val := Validate(RdlSchema(), "TypeRef", self.Type)
		if !val.Valid {
			return fmt.Errorf("StructFieldDef.type does not contain a valid TypeRef (%v)", val.Error)
		}
	}
	return nil
}
489855
func (m *Catalog) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateID(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if err := m.validateNode(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if err := m.validateSource(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
36235
func Validate(schema *Schema, typename string, data interface{}) Validation {
	v := getValidator(schema)
	return validateWithValidator(v, typename, data)
}
1173056
func (m *Service) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateSpec(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateStatus(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
488280
func (o *MultiAuthExampleAPI) Validate() error {
	var unregistered []string

	if o.JSONConsumer == nil {
		unregistered = append(unregistered, "JSONConsumer")
	}

	if o.JSONProducer == nil {
		unregistered = append(unregistered, "JSONProducer")
	}

	if o.HasRoleAuth == nil {
		unregistered = append(unregistered, "HasRoleAuth")
	}

	if o.IsRegisteredAuth == nil {
		unregistered = append(unregistered, "IsRegisteredAuth")
	}

	if o.IsResellerAuth == nil {
		unregistered = append(unregistered, "XCustomKeyAuth")
	}

	if o.IsResellerQueryAuth == nil {
		unregistered = append(unregistered, "CustomKeyAsQueryAuth")
	}

	if o.AddOrderHandler == nil {
		unregistered = append(unregistered, "AddOrderHandler")
	}

	if o.GetAccountHandler == nil {
		unregistered = append(unregistered, "GetAccountHandler")
	}

	if o.GetItemsHandler == nil {
		unregistered = append(unregistered, "GetItemsHandler")
	}

	if o.GetOrderHandler == nil {
		unregistered = append(unregistered, "GetOrderHandler")
	}

	if o.GetOrdersForItemHandler == nil {
		unregistered = append(unregistered, "GetOrdersForItemHandler")
	}

	if len(unregistered) > 0 {
		return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
	}

	return nil
}
1169017
func (r *BeeResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error {
	//	ps := data.(*BeePostStruct)
	// FIXME
	return nil
}
1051463
func (s *XPackSecurityPutRoleMappingService) Validate() error {
	var invalid []string
	if s.name == "" {
		invalid = append(invalid, "Name")
	}
	if s.body == nil {
		invalid = append(invalid, "Body")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}