Numbers & Integers¶
Both "type": "number" (floating-point) and "type": "integer" support the same set of constraint keywords.
Unconstrained¶
number¶
integer¶
Strategy: without bounds, picks from Faker's full numeric range. Use minimum/maximum to keep values in a practical range.
Range constraints¶
minimum / maximum¶
Strategy: for number, generates a random float uniformly in [minimum, maximum]. For integer, generates a random int in [minimum, maximum].
exclusiveMinimum / exclusiveMaximum¶
Draft-06+ numeric form (a number, not a boolean):
Draft-04 boolean form is also accepted:
{"type": "number", "minimum": 0.0, "maximum": 1.0, "exclusiveMinimum": true, "exclusiveMaximum": true}
Strategy: numeric exclusive bounds are converted to an open interval. For floats, a small epsilon is added/subtracted from the limit to stay strictly inside the boundary.
Limitations: draft-04 boolean exclusiveMinimum/exclusiveMaximum are supported, but numeric form (draft-06+) takes precedence when both are present.
Multiple constraint¶
multipleOf¶
Strategy: enumerates all valid multiples inside the [minimum, maximum] range and picks one at random.
Limitations:
multipleOfmust be greater than zero.- For unbounded ranges, the generator samples up to
max_searchcandidates and picks the first valid multiple; very sparse ranges may raiseNoExampleFoundError. - Floating-point arithmetic is performed via
Decimalto reduce precision errors, but edge cases near the boundary may still produce off-by-epsilon values.