Skip to content

Commit c80bb35

Browse files
committed
Remove coercion of decimal constraints
Backport of: #11772
1 parent 9f76e24 commit c80bb35

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pydantic/_internal/_known_annotated_metadata.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections import defaultdict
44
from collections.abc import Iterable
55
from copy import copy
6-
from decimal import Decimal
76
from functools import lru_cache, partial
87
from typing import TYPE_CHECKING, Any
98

@@ -220,10 +219,7 @@ def apply_known_metadata(annotation: Any, schema: CoreSchema) -> CoreSchema | No
220219
if constraint == 'union_mode' and schema_type == 'union':
221220
schema['mode'] = value # type: ignore # schema is UnionSchema
222221
else:
223-
if schema_type == 'decimal' and constraint in {'multiple_of', 'le', 'ge', 'lt', 'gt'}:
224-
schema[constraint] = Decimal(value)
225-
else:
226-
schema[constraint] = value
222+
schema[constraint] = value
227223
continue
228224

229225
# else, apply a function after validator to the schema to enforce the corresponding constraint

0 commit comments

Comments
 (0)