-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Go 1.17 - Test failure in gojsonschema time format validation #3589
Comments
olivierlemasle
changed the title
Go 1.17 - Test fail in gojsonschema time format validation
Go 1.17 - Test failure in gojsonschema time format validation
Jun 28, 2021
Thanks for raising this. Let's fix it. I'm not certain, but I don't think that this has a huge relevance for our use of json schema 🤔 Also, it would mean that some previously forbidden inputs become valid, as far as I understand. What would be the best approach in your opinion? I'm not sure this is even worth introducing a build tag for go 1.17 into our tests... 💭 |
Is that ok for you? |
olivierlemasle
added a commit
to olivierlemasle/opa
that referenced
this issue
Jun 28, 2021
Replace the time "01:01:01,1111" by "14:30", which is a ISO 8601 valid time, but not a RFC3339 "full time", and is rejected as such by the TimeFormatChecker. Fixes open-policy-agent#3589 Signed-off-by: Olivier Lemasle <[email protected]>
srenatus
pushed a commit
that referenced
this issue
Jun 28, 2021
Replace the time "01:01:01,1111" by "14:30", which is a ISO 8601 valid time, but not a RFC3339 "full time", and is rejected as such by the TimeFormatChecker. Fixes #3589 Signed-off-by: Olivier Lemasle <[email protected]>
juliafriedman8
pushed a commit
to juliafriedman8/opa
that referenced
this issue
Jul 13, 2021
…-agent#3591) Replace the time "01:01:01,1111" by "14:30", which is a ISO 8601 valid time, but not a RFC3339 "full time", and is rejected as such by the TimeFormatChecker. Fixes open-policy-agent#3589 Signed-off-by: Olivier Lemasle <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
Test success (works for Go <= 1.16)
Actual Behavior
Test failure with Go 1.17 rc:
Additional Info
A test in
internal/gojsonschema/testdata/draft7/optional/format/time.json
verifies that01:01:01,1111
fails to validate as a time.Time validation is done here:
opa/internal/gojsonschema/format_checkers.go
Lines 266 to 271 in 47feea7
However
_, err := time.Parse("15:04:05", "01:01:01,1111")
returns an errorparsing time "01:01:01,1111": extra text: ",1111"
with Go <= 1.16, and no error with Go 1.17.This is due to this change in Go: golang/go@f02a26b ("," supported as separator for fractional seconds)
The text was updated successfully, but these errors were encountered: