Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small validation error message formatting fix #575

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aea/configurations/validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2022-2023 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -243,7 +243,7 @@ def _validate(self, instance: Dict) -> None:
@staticmethod
def _build_message_from_errors(errors: List[jsonschema.ValidationError]) -> str:
"""Build an error message from validation errors."""
path = lambda error: ".".join(list(error.path)) # noqa # type: ignore
path = lambda error: "::".join(map(str, error.path)) # noqa
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error was on constructing error message string.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during the investigation another place of improvement was found:
#576

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path = lambda error: "::".join(map(str, error.path)) # noqa
path = lambda error: ".".join(map(str, error.path)) # noqa

result = [f"{path(error)}: {error.message}" for error in errors]
return "The following errors occurred during validation:\n - " + "\n - ".join(
result
Expand Down