You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your issue may already be reported!
Please search on the issue tracker before creating one.
Describe the bug
Validator fails on schema type "integer".
To Reproduce
Make a schema that contains an integer data type and then validate an object using that schema.
Expected behavior
Validation should pass
Additional context
Golang unmarshals all numbers as float64. The type check for data.(int) therefore fails.
What will succeed will be
case jsonschema.Integer:
if num, ok := data.(float64); ok {
if num == float64(int64(num)) {
return true
}
}
if _, ok := data.(int); ok {
return true // Just in case other versions of Golang support this
}
I don't have the time to create a PR at this point so I've just copied your validate.go into my own codebase FTTB.
The text was updated successfully, but these errors were encountered:
Your issue may already be reported!
Please search on the issue tracker before creating one.
Describe the bug
Validator fails on schema type "integer".
To Reproduce
Make a schema that contains an integer data type and then validate an object using that schema.
Expected behavior
Validation should pass
Additional context
Golang unmarshals all numbers as float64. The type check for
data.(int)
therefore fails.What will succeed will be
I don't have the time to create a PR at this point so I've just copied your
validate.go
into my own codebase FTTB.The text was updated successfully, but these errors were encountered: