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

Conversation

solarw
Copy link
Collaborator

@solarw solarw commented Feb 15, 2023

Proposed changes

small validation error message formatting fix

Fixes

#562

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Lint and unit tests pass locally with my changes and CI passes too
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease.
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

DELETE INCLUSIVE THIS AND BELOW FOR STANDARD PR

Release summary

Version number: [e.g. 1.0.1]

Release details

Describe in short the main changes with the new release.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the main branch (left side), from develop
  • Lint and unit tests pass locally and in CI
  • I have checked the fingerprint hashes are correct by running (aea packages lock --check)
  • I have regenerated the latest API docs
  • I built the documentation and updated it with the latest changes
  • I have added an item in HISTORY.md for this release
  • I bumped the version number in the aea/__version__.py file.
  • I bumped the version number in every Docker image of the repo and published it. Also, I built and published them with tag latest
    (check the READMEs of aea-develop
    and aea-user)
  • I have pushed the latest packages to the registry.
  • I have uploaded the latest aea to PyPI.
  • I have uploaded the latest plugins to PyPI.

Further comments

Write here any other comment about the release, if any.

@solarw solarw force-pushed the fix/better_error_msg_for_configuration_validation branch from d0c1702 to 32337b4 Compare February 15, 2023 08:01
@@ -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

@solarw solarw force-pushed the fix/better_error_msg_for_configuration_validation branch from 32337b4 to 901f201 Compare February 15, 2023 08:58
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2023

Codecov Report

Base: 93.38% // Head: 93.38% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (901f201) compared to base (5fd694b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #575      +/-   ##
==========================================
- Coverage   93.38%   93.38%   -0.01%     
==========================================
  Files         353      353              
  Lines       28451    28451              
==========================================
- Hits        26569    26568       -1     
- Misses       1882     1883       +1     
Flag Coverage Δ
unittests 93.38% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aea/configurations/validation.py 100.00% <100.00%> (ø)
aea/cli/check_packages.py 96.81% <0.00%> (-0.64%) ⬇️
aea/package_manager/v1.py 100.00% <0.00%> (+0.62%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link

@angrybayblade angrybayblade left a comment

Choose a reason for hiding this comment

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

LGTM, just one suggestion you can choose to accept it

@@ -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

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

@DavidMinarsch DavidMinarsch merged commit 9140c66 into main Feb 20, 2023
@DavidMinarsch DavidMinarsch deleted the fix/better_error_msg_for_configuration_validation branch February 20, 2023 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants