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

_evaluation_path length is not configurable #224

Closed
crisely09 opened this issue Mar 20, 2024 · 3 comments
Closed

_evaluation_path length is not configurable #224

crisely09 opened this issue Mar 20, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@crisely09
Copy link

We have been dealing with problems validating complex schemas because 30 is still a small path for us to traverse.
It would be incredibly helpful if the _evaluation_path limit was another parameter in the validate method.

@ashleysommer
Copy link
Collaborator

Thanks @crisely09 for raising this.

The length of 30 was chosen because it was the shortest evaluation_path length that allowed the most complex test in the PySHACL test suite to still pass. We found that SHACL evaluations more complex than that were extremely unlikely to be deliberately run by a user. By setting it to 30, we found that was a good way to expose unintended evaluation loops and other Shape targeting issues in the SHACL Shapes file, while still allowing shapes without issues to run unhindered.

Having said that, I can see that making it a configurable option makes sense, it would allow those with a legitimate use case to set it to whichever level they require.

I will add it to the list of changes for the next release.

@ashleysommer ashleysommer added the enhancement New feature or request label Mar 22, 2024
@ashleysommer
Copy link
Collaborator

Hi @crisely09
This is feature is now added in PySHACL v0.26.0

If you're using pyshacl on the commandline, you can pass --max-depth i where i is 1 to 999.
If you're using pyshacl as a library, you can use the validate() argument max_validation_depth.

Note, the depth is now calculated differently than before. The "validation depth" is now defined as the total number of Shapes in the evaluation path, where it was previously calculated as total (Shapes + Constraints) on the evaluation path.
Practically, that means "validation depth" is now half the recorded _evaluation_path length, so the default configured "validation depth" is 15, that matches the previous max "evaluation_path" length of 30.

So keep that in mind when setting a higher max depth limit.

@crisely09
Copy link
Author

Hi @ashleysommer ,
This is great news, I will keep in mind the meaning of the "validation depth", thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants