feedback static method

String feedback(
  1. ZorphyBoundaryResult<Object?> result
)

Renders result as the feedback a model can act on.

A success renders the empty string (nothing to correct); a failure renders one path expected X but got Y line per violation, which is the shape a model needs to repair its own arguments.

Implementation

static String feedback(ZorphyBoundaryResult<Object?> result) =>
    result.fold<String>(
      (_) => '',
      (error) => error.violations
          .map((v) => '${v.path} expected ${v.expected} but got ${v.actual}')
          .join('\n'),
    );