From 5a5c8f7adcf2cab1d82acc041d5004cb5609704a Mon Sep 17 00:00:00 2001 From: Eugene Eisenstein Date: Thu, 3 Sep 2026 13:14:39 -0400 Subject: [PATCH] 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) --- src/mock_provider/schema_gen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mock_provider/schema_gen.py b/src/mock_provider/schema_gen.py index 45c523b0..5a6339c0 100644 --- a/src/mock_provider/schema_gen.py +++ b/src/mock_provider/schema_gen.py @@ -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