Skip to content

Commit a79cd10

Browse files
authored
Add remark that JSON Schema multipleOf is unreliable for decimal fractions (#789)
1 parent 560e9e3 commit a79cd10

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

site/content/3.11/concepts/data-structure/documents/schema-validation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ this restriction.
348348
Attributes with numeric values always have the type `"number"`, even if they are
349349
whole numbers (and internally use an `integer` type). If you want to restrict an
350350
attribute to integer values, use `"type": "number"` together with `"multipleOf": 1`.
351+
Using `multipleOf` with decimal places is not recommended because it doesn't
352+
work reliably due to floating-point inaccuracy.
351353

352354
{{< security >}}
353355
Remote schemas are not supported for security reasons.

site/content/3.12/concepts/data-structure/documents/schema-validation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ this restriction.
348348
Attributes with numeric values always have the type `"number"`, even if they are
349349
whole numbers (and internally use an `integer` type). If you want to restrict an
350350
attribute to integer values, use `"type": "number"` together with `"multipleOf": 1`.
351+
Using `multipleOf` with decimal places is not recommended because it doesn't
352+
work reliably due to floating-point inaccuracy.
351353

352354
{{< security >}}
353355
Remote schemas are not supported for security reasons.

site/content/3.13/concepts/data-structure/documents/schema-validation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ this restriction.
348348
Attributes with numeric values always have the type `"number"`, even if they are
349349
whole numbers (and internally use an `integer` type). If you want to restrict an
350350
attribute to integer values, use `"type": "number"` together with `"multipleOf": 1`.
351+
Using `multipleOf` with decimal places is not recommended because it doesn't
352+
work reliably due to floating-point inaccuracy.
351353

352354
{{< security >}}
353355
Remote schemas are not supported for security reasons.

0 commit comments

Comments
 (0)