docs(mock-provider): correct the reason fractional multipleOf is dropped

The docstring claimed honouring it would mean returning a non-integer from an
integer schema. That is wrong: 3 is an integer and a multiple of 1.5. The real
reason is that it needs exact-decimal arithmetic to keep float drift from
deciding validity, and no Honcho response model emits multipleOf at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eugene Eisenstein 2026-09-03 13:14:39 -04:00
parent 786c74f32f
commit 5a5c8f7adc
1 changed files with 5 additions and 2 deletions

View File

@ -350,8 +350,11 @@ def _snap_to_multiple(
) -> int:
"""Move ``value`` onto a multiple of ``multiple``, staying within bounds.
A fractional ``multipleOf`` is ignored: ``as_int`` rejects it, and honouring
it would mean returning a non-integer from an ``integer`` schema.
Integer ``multipleOf`` only. The spec allows a fractional one, and an
integer can satisfy it (3 is a multiple of 1.5), but honouring it needs
exact-decimal arithmetic to avoid float drift deciding validity. ``as_int``
rejects it, so the constraint is dropped rather than approximated no
Honcho response model emits ``multipleOf`` at all.
"""
if multiple is None or multiple <= 0:
return value