Describe NonNegativeStrictInt reason for preference

This commit is contained in:
Olivier 'reivilibre
2026-05-13 17:54:48 +01:00
parent fd2a3e7567
commit a289786199
+4 -1
View File
@@ -208,7 +208,10 @@ For a Sentinel for internal (non-API-facing) use, instead consider
NonNegativeStrictInt = Annotated[StrictInt, annotated_types.Ge(0)]
"""A strict integer that must be greater than or equal to zero.
Should be preferred in place of Pydantic's own (lax) NonNegativeInt.
Should be preferred in place of Pydantic's own (lax) NonNegativeInt,
which will coerce strings to integers in a way that does not agree with
the Matrix specification (and would risk backing us into a backward compatibility
hole where we had to support input forms we didn't intend).
"""