format_validation_error#

technote.sources.tomlerrors.format_validation_error(error, *, root, source)#

Report everything wrong with a TOML file, in the file’s own terms.

Parameters:
  • error (ValidationError) – The validation failure, as pydantic raised it.

  • root (type[BaseModel]) – The model the file is validated into, which the error’s locations are walked against to be translated into addresses in the file.

  • source (str) – The name of the file, such as technote.toml, which the report opens by naming.

Returns:

The report: the file, then one paragraph per problem, each addressing a place in the file and saying what is wrong there. Several problems are numbered and counted, so they can be fixed in one pass rather than one build each.

Return type:

str