Skip to content

Commit ad12e47

Browse files
authored
Schema extra (#292)
* add extra to schema, fix #238 * remove validator_instance, switch arg order on function_after * switch all schema typeddicts to total=False
1 parent e671f33 commit ad12e47

File tree

4 files changed

+209
-136
lines changed

4 files changed

+209
-136
lines changed

generate_self_schema.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ def type_dict_schema(typed_dict) -> dict[str, Any]:
9292
schema = None
9393
if type(field_type) == ForwardRef:
9494
fr_arg = field_type.__forward_arg__
95-
fr_arg, matched = re.subn(r'NotRequired\[(.+)]', r'\1', fr_arg)
96-
if matched:
97-
required = False
9895

9996
fr_arg, matched = re.subn(r'Required\[(.+)]', r'\1', fr_arg)
10097
if matched:
@@ -116,9 +113,6 @@ def type_dict_schema(typed_dict) -> dict[str, Any]:
116113
if get_origin(field_type) == core_schema.Required:
117114
required = True
118115
field_type = field_type.__args__[0]
119-
if get_origin(field_type) == core_schema.NotRequired:
120-
required = False
121-
field_type = field_type.__args__[0]
122116

123117
schema = get_schema(field_type)
124118

0 commit comments

Comments
 (0)