@@ -335,24 +335,29 @@ def _getValidators(cls, fieldName) :
335335 return None
336336 return v
337337
338- validators = _getValidators (cls , fieldName )
338+ field = _getValidators (cls , fieldName )
339339
340- if validators is None :
340+ if field is None :
341341 if not cls ._validation ["allow_foreign_fields" ] :
342342 raise SchemaViolation (cls , fieldName )
343343 else :
344- return validators .validate (value )
344+ return field .validate (value )
345345
346346 @classmethod
347347 def validateDct (cls , dct ) :
348348 "validates a dictionary. The dictionary must be defined such as {field: value}. If the validation is unsuccefull, raises an InvalidDocument"
349- def _validate (dct , res ) :
349+ def _validate (dct , res , parentsStr = "" ) :
350350 for k , v in dct .items () :
351+ if len (parentsStr ) == 0 :
352+ ps = k
353+ else :
354+ ps = "%s.%s" % (parentsStr , k )
355+
351356 if type (v ) is dict :
352- _validate (v , res )
357+ _validate (v , res , ps )
353358 elif k not in cls .arangoPrivates :
354359 try :
355- cls .validateField (k , v )
360+ cls .validateField (ps , v )
356361 except (ValidationError , SchemaViolation ) as e :
357362 res [k ] = str (e )
358363
0 commit comments