@@ -216,6 +216,7 @@ struct ValidationErrorArgs {
216216 verbose_message : String ,
217217 schema_path : Py < PyList > ,
218218 instance_path : Py < PyList > ,
219+ evaluation_path : Py < PyList > ,
219220 kind : ValidationErrorKind ,
220221 instance : Py < PyAny > ,
221222}
@@ -231,6 +232,7 @@ fn create_validation_error_object(
231232 args. verbose_message ,
232233 args. schema_path ,
233234 args. instance_path ,
235+ args. evaluation_path ,
234236 kind_obj,
235237 args. instance ,
236238 ) ) ?;
@@ -410,15 +412,23 @@ impl ValidationErrorKind {
410412 jsonschema:: error:: ValidationErrorKind :: PropertyNames { error } => {
411413 ValidationErrorKind :: PropertyNames {
412414 error : {
413- let ( message, verbose_message, schema_path, instance_path, kind, instance) =
414- into_validation_error_args ( py, * error, mask) ?;
415+ let (
416+ message,
417+ verbose_message,
418+ schema_path,
419+ instance_path,
420+ evaluation_path,
421+ kind,
422+ instance,
423+ ) = into_validation_error_args ( py, * error, mask) ?;
415424 create_validation_error_object (
416425 py,
417426 ValidationErrorArgs {
418427 message,
419428 verbose_message,
420429 schema_path,
421430 instance_path,
431+ evaluation_path,
422432 kind,
423433 instance,
424434 } ,
@@ -476,8 +486,15 @@ fn convert_validation_context(
476486 let mut py_errors: Vec < Py < PyAny > > = Vec :: with_capacity ( errors. len ( ) ) ;
477487
478488 for error in errors {
479- let ( message, verbose_message, schema_path, instance_path, kind, instance) =
480- into_validation_error_args ( py, error, mask) ?;
489+ let (
490+ message,
491+ verbose_message,
492+ schema_path,
493+ instance_path,
494+ evaluation_path,
495+ kind,
496+ instance,
497+ ) = into_validation_error_args ( py, error, mask) ?;
481498
482499 py_errors. push ( create_validation_error_object (
483500 py,
@@ -486,6 +503,7 @@ fn convert_validation_context(
486503 verbose_message,
487504 schema_path,
488505 instance_path,
506+ evaluation_path,
489507 kind,
490508 instance,
491509 } ,
@@ -523,6 +541,7 @@ fn into_validation_error_args(
523541 String ,
524542 Py < PyList > ,
525543 Py < PyList > ,
544+ Py < PyList > ,
526545 ValidationErrorKind ,
527546 Py < PyAny > ,
528547) > {
@@ -532,7 +551,7 @@ fn into_validation_error_args(
532551 error. to_string ( )
533552 } ;
534553 let verbose_message = to_error_message ( & error, message. clone ( ) , mask) ;
535- let ( instance, kind, instance_path, schema_path) = error. into_parts ( ) ;
554+ let ( instance, kind, instance_path, schema_path, evaluation_path ) = error. into_parts ( ) ;
536555 let into_path = |segment : LocationSegment < ' _ > | match segment {
537556 LocationSegment :: Property ( property) => {
538557 property. into_pyobject ( py) . and_then ( Py :: < PyAny > :: try_from)
@@ -549,13 +568,19 @@ fn into_validation_error_args(
549568 . map ( into_path)
550569 . collect :: < Result < Vec < _ > , _ > > ( ) ?;
551570 let instance_path = PyList :: new ( py, elements) ?. unbind ( ) ;
571+ let elements = evaluation_path
572+ . into_iter ( )
573+ . map ( into_path)
574+ . collect :: < Result < Vec < _ > , _ > > ( ) ?;
575+ let evaluation_path = PyList :: new ( py, elements) ?. unbind ( ) ;
552576 let kind = ValidationErrorKind :: try_new ( py, kind, mask) ?;
553577 let instance = value_to_python ( py, instance. as_ref ( ) ) ?;
554578 Ok ( (
555579 message,
556580 verbose_message,
557581 schema_path,
558582 instance_path,
583+ evaluation_path,
559584 kind,
560585 instance,
561586 ) )
@@ -565,7 +590,7 @@ fn into_py_err(
565590 error : jsonschema:: ValidationError < ' _ > ,
566591 mask : Option < & str > ,
567592) -> PyResult < PyErr > {
568- let ( message, verbose_message, schema_path, instance_path, kind, instance) =
593+ let ( message, verbose_message, schema_path, instance_path, evaluation_path , kind, instance) =
569594 into_validation_error_args ( py, error, mask) ?;
570595 validation_error_pyerr (
571596 py,
@@ -574,6 +599,7 @@ fn into_py_err(
574599 verbose_message,
575600 schema_path,
576601 instance_path,
602+ evaluation_path,
577603 kind,
578604 instance,
579605 } ,
0 commit comments