@@ -96,6 +96,8 @@ class CoreConfig(TypedDict, total=False):
9696 validate_default : bool
9797 # used on typed-dicts and arguments
9898 populate_by_name : bool # replaces `allow_population_by_field_name` in pydantic v1
99+ # stop validation on a first error, used with typed-dict, model-fields, and dataclass fields
100+ fail_fast : bool
99101 # fields related to string fields only
100102 str_max_length : int
101103 str_min_length : int
@@ -1885,6 +1887,7 @@ class DictSchema(TypedDict, total=False):
18851887 values_schema : CoreSchema # default: AnySchema
18861888 min_length : int
18871889 max_length : int
1890+ fail_fast : bool
18881891 strict : bool
18891892 ref : str
18901893 metadata : Dict [str , Any ]
@@ -1897,6 +1900,7 @@ def dict_schema(
18971900 * ,
18981901 min_length : int | None = None ,
18991902 max_length : int | None = None ,
1903+ fail_fast : bool | None = None ,
19001904 strict : bool | None = None ,
19011905 ref : str | None = None ,
19021906 metadata : Dict [str , Any ] | None = None ,
@@ -1920,6 +1924,7 @@ def dict_schema(
19201924 values_schema: The value must be a dict with values that match this schema
19211925 min_length: The value must be a dict with at least this many items
19221926 max_length: The value must be a dict with at most this many items
1927+ fail_fast: Stop validation on the first error
19231928 strict: Whether the keys and values should be validated with strict mode
19241929 ref: optional unique identifier of the schema, used to reference the schema in other places
19251930 metadata: Any other information you want to include with the schema, not used by pydantic-core
@@ -1931,6 +1936,7 @@ def dict_schema(
19311936 values_schema = values_schema ,
19321937 min_length = min_length ,
19331938 max_length = max_length ,
1939+ fail_fast = fail_fast ,
19341940 strict = strict ,
19351941 ref = ref ,
19361942 metadata = metadata ,
@@ -2868,6 +2874,7 @@ class TypedDictSchema(TypedDict, total=False):
28682874 extra_behavior : ExtraBehavior
28692875 total : bool # default: True
28702876 populate_by_name : bool # replaces `allow_population_by_field_name` in pydantic v1
2877+ fail_fast : bool # default: False
28712878 ref : str
28722879 metadata : Dict [str , Any ]
28732880 serialization : SerSchema
@@ -2884,6 +2891,7 @@ def typed_dict_schema(
28842891 extra_behavior : ExtraBehavior | None = None ,
28852892 total : bool | None = None ,
28862893 populate_by_name : bool | None = None ,
2894+ fail_fast : bool | None = None ,
28872895 ref : str | None = None ,
28882896 metadata : Dict [str , Any ] | None = None ,
28892897 serialization : SerSchema | None = None ,
@@ -2918,6 +2926,7 @@ class MyTypedDict(TypedDict):
29182926 extra_behavior: The extra behavior to use for the typed dict
29192927 total: Whether the typed dict is total, otherwise uses `typed_dict_total` from config
29202928 populate_by_name: Whether the typed dict should populate by name
2929+ fail_fast: Stop validation on the first error
29212930 serialization: Custom serialization schema
29222931 """
29232932 return _dict_not_none (
@@ -2930,6 +2939,7 @@ class MyTypedDict(TypedDict):
29302939 extra_behavior = extra_behavior ,
29312940 total = total ,
29322941 populate_by_name = populate_by_name ,
2942+ fail_fast = fail_fast ,
29332943 ref = ref ,
29342944 metadata = metadata ,
29352945 serialization = serialization ,
@@ -2994,6 +3004,7 @@ class ModelFieldsSchema(TypedDict, total=False):
29943004 # all these values can be set via config, equivalent fields have `typed_dict_` prefix
29953005 extra_behavior : ExtraBehavior
29963006 populate_by_name : bool # replaces `allow_population_by_field_name` in pydantic v1
3007+ fail_fast : bool # default: False
29973008 from_attributes : bool
29983009 ref : str
29993010 metadata : Dict [str , Any ]
@@ -3010,6 +3021,7 @@ def model_fields_schema(
30103021 extra_behavior : ExtraBehavior | None = None ,
30113022 populate_by_name : bool | None = None ,
30123023 from_attributes : bool | None = None ,
3024+ fail_fast : bool | None = None ,
30133025 ref : str | None = None ,
30143026 metadata : Dict [str , Any ] | None = None ,
30153027 serialization : SerSchema | None = None ,
@@ -3039,6 +3051,7 @@ def model_fields_schema(
30393051 extra_behavior: The extra behavior to use for the typed dict
30403052 populate_by_name: Whether the typed dict should populate by name
30413053 from_attributes: Whether the typed dict should be populated from attributes
3054+ fail_fast: Stop validation on the first error
30423055 serialization: Custom serialization schema
30433056 """
30443057 return _dict_not_none (
@@ -3051,6 +3064,7 @@ def model_fields_schema(
30513064 extra_behavior = extra_behavior ,
30523065 populate_by_name = populate_by_name ,
30533066 from_attributes = from_attributes ,
3067+ fail_fast = fail_fast ,
30543068 ref = ref ,
30553069 metadata = metadata ,
30563070 serialization = serialization ,
@@ -3234,6 +3248,7 @@ class DataclassArgsSchema(TypedDict, total=False):
32343248 fields : Required [List [DataclassField ]]
32353249 computed_fields : List [ComputedField ]
32363250 populate_by_name : bool # default: False
3251+ fail_fast : bool # default: False
32373252 collect_init_only : bool # default: False
32383253 ref : str
32393254 metadata : Dict [str , Any ]
@@ -3247,6 +3262,7 @@ def dataclass_args_schema(
32473262 * ,
32483263 computed_fields : List [ComputedField ] | None = None ,
32493264 populate_by_name : bool | None = None ,
3265+ fail_fast : bool | None = None ,
32503266 collect_init_only : bool | None = None ,
32513267 ref : str | None = None ,
32523268 metadata : Dict [str , Any ] | None = None ,
@@ -3275,6 +3291,7 @@ def dataclass_args_schema(
32753291 fields: The fields to use for the dataclass
32763292 computed_fields: Computed fields to use when serializing the dataclass
32773293 populate_by_name: Whether to populate by name
3294+ fail_fast: Stop validation on the first error
32783295 collect_init_only: Whether to collect init only fields into a dict to pass to `__post_init__`
32793296 ref: optional unique identifier of the schema, used to reference the schema in other places
32803297 metadata: Any other information you want to include with the schema, not used by pydantic-core
@@ -3287,6 +3304,7 @@ def dataclass_args_schema(
32873304 fields = fields ,
32883305 computed_fields = computed_fields ,
32893306 populate_by_name = populate_by_name ,
3307+ fail_fast = fail_fast ,
32903308 collect_init_only = collect_init_only ,
32913309 ref = ref ,
32923310 metadata = metadata ,
0 commit comments