jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
56 stars 58 forks source link

make date-time RFC3339 compatible #238

Closed Skeeve closed 3 years ago

Skeeve commented 3 years ago

RFC3339 states that the UTC offset needs to have 2 digit hour and minute offset.

Previous regexp allows for 1+ digits so "+1:1" and "-0123456789:9876543210" would be accepted.

Summary

While using Openapi Plugin I noticed that it doesn't accept ISO timestamps. While this is fine, as Openapi spec states that the format be RFC3339, I noticed that the regexp checking the dates is too lax.

Motivation

I see no advantage in accepting wrong time offsets like 123:567.

References

Discussion on IRC. Don't know how to link to it.

Spec: OpenAPI RFC: RFC3339 See:

   time-hour       = 2DIGIT  ; 00-23
   time-minute     = 2DIGIT  ; 00-59
   time-numoffset  = ("+" / "-") time-hour ":" time-minute
jhthorsen commented 3 years ago

Oh. Didn't notice you made this PR until I released 4.13.

Duplicate of #236