@@ -6,7 +6,7 @@ from _typeshed import SupportsAllComparisons
66from typing_extensions import LiteralString , Self , TypeAlias
77
88from pydantic_core import ErrorDetails , ErrorTypeInfo , InitErrorDetails , MultiHostHost
9- from pydantic_core .core_schema import CoreConfig , CoreSchema , ErrorType
9+ from pydantic_core .core_schema import CoreConfig , CoreSchema , ErrorType , ExtraBehavior
1010
1111__all__ = [
1212 '__version__' ,
@@ -92,6 +92,7 @@ class SchemaValidator:
9292 input : Any ,
9393 * ,
9494 strict : bool | None = None ,
95+ extra : ExtraBehavior | None = None ,
9596 from_attributes : bool | None = None ,
9697 context : Any | None = None ,
9798 self_instance : Any | None = None ,
@@ -106,6 +107,8 @@ class SchemaValidator:
106107 input: The Python object to validate.
107108 strict: Whether to validate the object in strict mode.
108109 If `None`, the value of [`CoreConfig.strict`][pydantic_core.core_schema.CoreConfig] is used.
110+ extra: Whether to ignore, allow, or forbid extra data during model validation.
111+ If `None`, the value of [`CoreConfig.extra_fields_behavior`][pydantic_core.core_schema.CoreConfig] is used.
109112 from_attributes: Whether to validate objects as inputs to models by extracting attributes.
110113 If `None`, the value of [`CoreConfig.from_attributes`][pydantic_core.core_schema.CoreConfig] is used.
111114 context: The context to use for validation, this is passed to functional validators as
@@ -130,6 +133,7 @@ class SchemaValidator:
130133 input : Any ,
131134 * ,
132135 strict : bool | None = None ,
136+ extra : ExtraBehavior | None = None ,
133137 from_attributes : bool | None = None ,
134138 context : Any | None = None ,
135139 self_instance : Any | None = None ,
@@ -150,6 +154,7 @@ class SchemaValidator:
150154 input : str | bytes | bytearray ,
151155 * ,
152156 strict : bool | None = None ,
157+ extra : ExtraBehavior | None = None ,
153158 context : Any | None = None ,
154159 self_instance : Any | None = None ,
155160 allow_partial : bool | Literal ['off' , 'on' , 'trailing-strings' ] = False ,
@@ -169,6 +174,8 @@ class SchemaValidator:
169174 input: The JSON data to validate.
170175 strict: Whether to validate the object in strict mode.
171176 If `None`, the value of [`CoreConfig.strict`][pydantic_core.core_schema.CoreConfig] is used.
177+ extra: Whether to ignore, allow, or forbid extra data during model validation.
178+ If `None`, the value of [`CoreConfig.extra_fields_behavior`][pydantic_core.core_schema.CoreConfig] is used.
172179 context: The context to use for validation, this is passed to functional validators as
173180 [`info.context`][pydantic_core.core_schema.ValidationInfo.context].
174181 self_instance: An instance of a model set attributes on from validation.
@@ -190,6 +197,7 @@ class SchemaValidator:
190197 input : _StringInput ,
191198 * ,
192199 strict : bool | None = None ,
200+ extra : ExtraBehavior | None = None ,
193201 context : Any | None = None ,
194202 allow_partial : bool | Literal ['off' , 'on' , 'trailing-strings' ] = False ,
195203 by_alias : bool | None = None ,
@@ -205,6 +213,8 @@ class SchemaValidator:
205213 input: The input as a string, or bytes/bytearray if `strict=False`.
206214 strict: Whether to validate the object in strict mode.
207215 If `None`, the value of [`CoreConfig.strict`][pydantic_core.core_schema.CoreConfig] is used.
216+ extra: Whether to ignore, allow, or forbid extra data during model validation.
217+ If `None`, the value of [`CoreConfig.extra_fields_behavior`][pydantic_core.core_schema.CoreConfig] is used.
208218 context: The context to use for validation, this is passed to functional validators as
209219 [`info.context`][pydantic_core.core_schema.ValidationInfo.context].
210220 allow_partial: Whether to allow partial validation; if `True` errors in the last element of sequences
@@ -227,6 +237,7 @@ class SchemaValidator:
227237 field_value : Any ,
228238 * ,
229239 strict : bool | None = None ,
240+ extra : ExtraBehavior | None = None ,
230241 from_attributes : bool | None = None ,
231242 context : Any | None = None ,
232243 by_alias : bool | None = None ,
@@ -241,6 +252,8 @@ class SchemaValidator:
241252 field_value: The value to assign to the field.
242253 strict: Whether to validate the object in strict mode.
243254 If `None`, the value of [`CoreConfig.strict`][pydantic_core.core_schema.CoreConfig] is used.
255+ extra: Whether to ignore, allow, or forbid extra data during model validation.
256+ If `None`, the value of [`CoreConfig.extra_fields_behavior`][pydantic_core.core_schema.CoreConfig] is used.
244257 from_attributes: Whether to validate objects as inputs to models by extracting attributes.
245258 If `None`, the value of [`CoreConfig.from_attributes`][pydantic_core.core_schema.CoreConfig] is used.
246259 context: The context to use for validation, this is passed to functional validators as
0 commit comments