Double.Min|Max values do not trigger an error for integer type property
Closed this issue · 2 comments
avkonst commented
Hi,
I have applied your fix for int32|int64 formats. Works great now.
Now about doubles :) I have spotted in tests that the following instance (magic number is Double.Max):
{
"prop" : 1.7976931348623157E+308
}
is validated successfully against the schema:
{
"type" : "object",
"properties" : {
"prop" : {
"type" : "integer"
}
}
}
expected result is failure on validation. The similar issue exists for Double.Min.
edgarmueller commented
I'm unsure about this since the validator currently validates numbers against the integer type successfully if they are whole. This relates to the same question whether { "prop": 1.0 }
should validate, which is the case right now. There has been quite the discussion about this in the past, see here. I think I'd prefer to stick with the current behaviour. Do you have any objections?
avkonst commented
No objections, thanks. It was my fault. The current behavior is correct.
…On Tue, May 9, 2017 at 7:57 AM, Edgar Müller ***@***.***> wrote:
I'm unsure about this since the validator currently validates numbers
against the integer type successfully if they are whole. This relates to
the same question whether { "prop": 1.0 } should validate, which is the
case right now. There has been quite the discussion about this in the past,
see here <json-schema/json-schema#27>. I think
I'd prefer to stick with the current behaviour. Do you have any objections?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#111 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADyZVbISB-GMyn_sZbejWDTVoU6UTiCUks5r33OygaJpZM4NRziU>
.