@@ -6,7 +6,7 @@ from _typeshed import SupportsAllComparisons
6
6
from typing_extensions import LiteralString , Self , TypeAlias
7
7
8
8
from 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
10
10
11
11
__all__ = [
12
12
'__version__' ,
@@ -92,6 +92,7 @@ class SchemaValidator:
92
92
input : Any ,
93
93
* ,
94
94
strict : bool | None = None ,
95
+ extra : ExtraBehavior | None = None ,
95
96
from_attributes : bool | None = None ,
96
97
context : Any | None = None ,
97
98
self_instance : Any | None = None ,
@@ -106,6 +107,8 @@ class SchemaValidator:
106
107
input: The Python object to validate.
107
108
strict: Whether to validate the object in strict mode.
108
109
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.
109
112
from_attributes: Whether to validate objects as inputs to models by extracting attributes.
110
113
If `None`, the value of [`CoreConfig.from_attributes`][pydantic_core.core_schema.CoreConfig] is used.
111
114
context: The context to use for validation, this is passed to functional validators as
@@ -130,6 +133,7 @@ class SchemaValidator:
130
133
input : Any ,
131
134
* ,
132
135
strict : bool | None = None ,
136
+ extra : ExtraBehavior | None = None ,
133
137
from_attributes : bool | None = None ,
134
138
context : Any | None = None ,
135
139
self_instance : Any | None = None ,
@@ -150,6 +154,7 @@ class SchemaValidator:
150
154
input : str | bytes | bytearray ,
151
155
* ,
152
156
strict : bool | None = None ,
157
+ extra : ExtraBehavior | None = None ,
153
158
context : Any | None = None ,
154
159
self_instance : Any | None = None ,
155
160
allow_partial : bool | Literal ['off' , 'on' , 'trailing-strings' ] = False ,
@@ -169,6 +174,8 @@ class SchemaValidator:
169
174
input: The JSON data to validate.
170
175
strict: Whether to validate the object in strict mode.
171
176
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.
172
179
context: The context to use for validation, this is passed to functional validators as
173
180
[`info.context`][pydantic_core.core_schema.ValidationInfo.context].
174
181
self_instance: An instance of a model set attributes on from validation.
@@ -190,6 +197,7 @@ class SchemaValidator:
190
197
input : _StringInput ,
191
198
* ,
192
199
strict : bool | None = None ,
200
+ extra : ExtraBehavior | None = None ,
193
201
context : Any | None = None ,
194
202
allow_partial : bool | Literal ['off' , 'on' , 'trailing-strings' ] = False ,
195
203
by_alias : bool | None = None ,
@@ -205,6 +213,8 @@ class SchemaValidator:
205
213
input: The input as a string, or bytes/bytearray if `strict=False`.
206
214
strict: Whether to validate the object in strict mode.
207
215
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.
208
218
context: The context to use for validation, this is passed to functional validators as
209
219
[`info.context`][pydantic_core.core_schema.ValidationInfo.context].
210
220
allow_partial: Whether to allow partial validation; if `True` errors in the last element of sequences
@@ -227,6 +237,7 @@ class SchemaValidator:
227
237
field_value : Any ,
228
238
* ,
229
239
strict : bool | None = None ,
240
+ extra : ExtraBehavior | None = None ,
230
241
from_attributes : bool | None = None ,
231
242
context : Any | None = None ,
232
243
by_alias : bool | None = None ,
@@ -241,6 +252,8 @@ class SchemaValidator:
241
252
field_value: The value to assign to the field.
242
253
strict: Whether to validate the object in strict mode.
243
254
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.
244
257
from_attributes: Whether to validate objects as inputs to models by extracting attributes.
245
258
If `None`, the value of [`CoreConfig.from_attributes`][pydantic_core.core_schema.CoreConfig] is used.
246
259
context: The context to use for validation, this is passed to functional validators as
0 commit comments