Skip to content

Commit

Permalink
squash: fix docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Aug 27, 2024
1 parent f1f18df commit 4707545
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tmt/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5311,15 +5311,23 @@ def _process_step_collection(step_name: str, step_collection: Any) -> None:


def preformat_jsonschema_validation_errors(
raw_errors: list[Any],
raw_errors: list[jsonschema.ValidationError],
prefix: Optional[str] = None) -> list[tuple[jsonschema.ValidationError, str]]:
"""
A bit of error formatting for JSON schema validation.
It is possible to use str(error), but the result is a bit too
JSON-ish. Let's present an error message in a way that helps users
to point finger on each and every issue. But don't throw the
original errors away!
A helper to preformat JSON schema validation errors.
Raw errors can be converted to strings with a simple ``str()`` call,
but resulting string is very JSON-ish. This helper provides
simplified string representation consisting of error message and
element path.
:param raw_error: raw validation errors as provided by
:py:mod:`jsonschema`.
:param prefix: if specified, it is added at the beginning of each
stringified error.
:returns: a list of two-item tuples, the first item being the
original validation error, the second item being its simplified
string rendering.
"""

prefix = f'{prefix}:' if prefix else ''
Expand Down

0 comments on commit 4707545

Please sign in to comment.