Skip to content

Commit 8f60642

Browse files
committed
rename full -> total on typeddicts, my original mistake
1 parent 5e36e91 commit 8f60642

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pydantic_core/_types.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Config(TypedDict, total=False):
3333
config_merge_priority: int
3434
# settings related to typed_dicts only
3535
typed_dict_extra_behavior: Literal['allow', 'forbid', 'ignore']
36-
typed_dict_full: bool # default: True
36+
typed_dict_total: bool # default: True
3737
# used on typed-dicts and tagged union keys
3838
from_attributes: bool
3939
revalidate_models: bool
@@ -136,7 +136,7 @@ class TypedDictSchema(TypedDict, total=False):
136136
ref: str
137137
# all these values can be set via config, equivalent fields have `typed_dict_` prefix
138138
extra_behavior: Literal['allow', 'forbid', 'ignore']
139-
full: bool # default: True
139+
total: bool # default: True
140140
populate_by_name: bool # replaces `allow_population_by_field_name` in pydantic v1
141141
from_attributes: bool
142142

src/validators/typed_dict.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ impl BuildValidator for TypedDictValidator {
7474
intern!(py, "extra_behavior"),
7575
intern!(py, "typed_dict_extra_behavior"),
7676
)?;
77-
let full =
78-
schema_or_config(schema, config, intern!(py, "full"), intern!(py, "typed_dict_full"))?.unwrap_or(true);
77+
let total =
78+
schema_or_config(schema, config, intern!(py, "total"), intern!(py, "typed_dict_total"))?.unwrap_or(true);
7979
let from_attributes = schema_or_config_same(schema, config, intern!(py, "from_attributes"))?.unwrap_or(false);
8080
let populate_by_name = schema_or_config_same(schema, config, intern!(py, "populate_by_name"))?.unwrap_or(false);
8181

@@ -137,7 +137,7 @@ impl BuildValidator for TypedDictValidator {
137137
}
138138
required
139139
}
140-
None => full,
140+
None => total,
141141
};
142142

143143
let on_error = match field_info.get_as::<&str>(intern!(py, "on_error"))? {

tests/validators/test_typed_dict.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ def test_fields_required_by_default_with_default():
401401

402402

403403
def test_all_optional_fields():
404-
"""By default all fields should be optional if `full` is set to `False`"""
404+
"""By default all fields should be optional if `total` is set to `False`"""
405405
v = SchemaValidator(
406406
{
407407
'type': 'typed-dict',
408-
'full': False,
408+
'total': False,
409409
'return_fields_set': True,
410410
'fields': {'x': {'schema': {'type': 'str', 'strict': True}}, 'y': {'schema': {'type': 'str'}}},
411411
}
@@ -427,7 +427,7 @@ def test_all_optional_fields_with_required_fields():
427427
v = SchemaValidator(
428428
{
429429
'type': 'typed-dict',
430-
'full': False,
430+
'total': False,
431431
'return_fields_set': True,
432432
'fields': {
433433
'x': {'schema': {'type': 'str', 'strict': True}, 'required': True},

0 commit comments

Comments
 (0)