Skip to content

Invalid date-time fails validation #478

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
tomsfernandez opened this issue Feb 14, 2023 · 5 comments
Closed

Invalid date-time fails validation #478

tomsfernandez opened this issue Feb 14, 2023 · 5 comments

Comments

@tomsfernandez
Copy link

tomsfernandez commented Feb 14, 2023

When using a date-time with a day that exceeds the max amount of days in a month like February 30th the validator doesn't fail.

I added this test to test/vanilla/src/main/resources/org/everit/json/schema/draft7/date-time.json

{
  "description": "only RFC3339 invalid date-time according to calendar rules",
  "data": "1963-02-30T00:00:00Z",
  "valid": false
}
@erosb
Copy link
Contributor

erosb commented Feb 14, 2023

@tomsfernandez are you sure you are at the right repo? This error description doesn't look any familiar. This library formats date-time validation errors like this:

return Optional.of(String.format("[%s] is not a valid %s. Expected %s", subject, formatName(), formatsAccepted));

@tomsfernandez
Copy link
Author

tomsfernandez commented Feb 14, 2023

@erosb Hi! I created a draft PR with the bug: #479. Of course I don't mean to merge it, I found it easier to show the case and how I ran it by showing the code.

@erosb
Copy link
Contributor

erosb commented Feb 14, 2023

Interesting. I can't see anything in RFC3339 that forbids this string, but still it is obviously stupid. You can raise a PR with a fix if you want and I'm happy to review. I won't have time to fix it on my own.

@tomsfernandez
Copy link
Author

Sure! btw "5.7. Restrictions" of the RFC states what I pointed at in this issue.

@erosb
Copy link
Contributor

erosb commented Apr 17, 2023

Hello @tomsfernandez I released a new validator, it has better "date-time" support than this library. You can take a look if it better fits your needs.

@erosb erosb closed this as completed Apr 17, 2023
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