Skip to content

[DX] include actual count in collection constraint errors #501

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

Closed
dkarlovi opened this issue Mar 29, 2018 · 2 comments · Fixed by #797
Closed

[DX] include actual count in collection constraint errors #501

dkarlovi opened this issue Mar 29, 2018 · 2 comments · Fixed by #797

Comments

@dkarlovi
Copy link
Contributor

Really small life quality tweak.

Currently, I'm getting this:

      JSON does not validate. Violations:
        - [] There must be a minimum of 30 items in the array

I'd like this:

      JSON does not validate. Violations:
        - [] There must be a minimum of 30 items in the array, 10 found
@shmax
Copy link
Collaborator

shmax commented Mar 29, 2018

SGTM. Please open a PR.

@DannyvdSluijs
Copy link
Collaborator

DannyvdSluijs commented Feb 26, 2025

As a starter error messages are defined in the \JsonSchema\Exception\InvalidArgumentException\ConstraintError class. For this report you would need to alter the message and where it is being used such as in the \JsonSchema\Constraints\CollectionConstraint, see here, where you'll need to pass the number of items found.

The same improvement should be suggested for the max items as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants