Skip to content

fix(sh:message): messages not being copied into the report #7

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dev-aravind
Copy link

closes #6

@CLAassistant
Copy link

CLAassistant commented Jun 17, 2025

CLA assistant check
All committers have signed the CLA.

@saumier
Copy link

saumier commented Jun 17, 2025

@gkellogg Hi. I worked with @dev-aravind on this PR and we noticed that the tests were not catching the issue we fixed. Before the fix the test passed and after the fix the test passed.

Specifically the unit tests for the w3c-data-shapes seem to compare the report objects, which does not fail if the messages are not the same in the expected and generated report. Here is the exact line where the comparison occurs.

Additional observations:

  • Most of the test cases will fail upon a deep compare because of the default messages that the package uses when there is no explicit message.
  • Sometimes the generated validation report will have reports for the failures as well as the success cases, but the expected report will have only the results for the failures. For example, https://github.com/w3c/data-shapes/blob/gh-pages/data-shapes-test-suite/tests/core/node/and-001.ttl has 2 expected results, but the SHACL library will produce an additional third result with the message "node conforms to all shapes"

In short, we are wondering if you could help guide us on how to fix this. If you prefer, you can also email me directly. Thanks in advance.

@gkellogg
Copy link
Member

What you've done so far looks good, but I'd like to fix the report comparison logic. This probably just requires creating a :== method on the class that will do a deep compare. (Of course, this may lead to additional work for any other tests that would now fail).

It's been some time since I've worked on this gem, so I'd need to dive in to remember the various implementation details, but this seems like the right direction.

@dev-aravind dev-aravind force-pushed the 2-shmessage-not-working-as-expected branch from 72cb2b4 to 9a367e6 Compare June 19, 2025 13:04
@dev-aravind
Copy link
Author

@gkellogg I realized I had missed an existing deep comparison function for the ValidationResult struct. I've now updated it to include comparison of the sh:message as well. The unit tests seem to be passing now.

  • Most of the test cases will fail upon a deep compare because of the default messages that the package uses when there is no explicit message.

This is fixed now as the comparison returns true if the expected value is nil.

  • Sometimes the generated validation report will have reports for the failures as well as the success cases

This is also working fine as the results function only returns the non-conforming results.

cc @saumier

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.

sh:message not working as expected
4 participants