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

Incorrect error message for arrays #78

Closed
drawohkam opened this issue Mar 9, 2017 · 1 comment
Closed

Incorrect error message for arrays #78

drawohkam opened this issue Mar 9, 2017 · 1 comment

Comments

@drawohkam
Copy link

When an array has the "maxItems" set. The validation error message fails to display the maxItems value.

  try
  {
     String schemaString = "{\"type\": \"object\", \"properties\": {\"foo\": {\"type\": \"array\", \"maxItems\": 1, \"items\": {\"type\": \"string\"}}}}";
     Schema schema = SchemaLoader.load(new JSONObject(schemaString));
     schema.validate(new JSONObject("{\"foo\": [\"\", \"\"]}"));
  } catch (ValidationException e)
  {
     System.out.println(e.getMessage());
  }

The error message:

#/foo: expected maximum item count: null, found: 2

The "null" should be 1 in this example.

erosb added a commit that referenced this issue Mar 9, 2017
erosb added a commit that referenced this issue Mar 9, 2017
@erosb
Copy link
Contributor

erosb commented Mar 9, 2017

Thanks for reporting it @drawohkam , I fixed it in 1343ab3 , it will be included in the next release.

@erosb erosb closed this as completed Mar 9, 2017
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

No branches or pull requests

2 participants