// Performs validation and combines errors from validation // with errors from deserialization, then maps both the // resulting struct and the errors to the context. func validateAndMap(obj reflect.Value, context martini.Context, errors Errors, ifacePtr ...interface{}) { context.Invoke(Validate(obj.Interface())) errors = append(errors, getErrors(context)...) context.Map(errors) context.Map(obj.Elem().Interface()) if len(ifacePtr) > 0 { context.MapTo(obj.Elem().Interface(), ifacePtr[0]) } }