File tree 2 files changed +3
-4
lines changed
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -310,8 +310,7 @@ def deference_json_schema(
310
310
if def_schema is None :
311
311
raise ValueError (f'Invalid $ref "{ ref } ", not found in { defs } ' )
312
312
else :
313
- # clone dict to avoid attribute leakage
314
- return def_schema .copy (), required
313
+ return def_schema .copy (), required # clone dict to avoid attribute leakage via shared schema
315
314
elif any_of := schema .get ('anyOf' ):
316
315
if len (any_of ) == 2 and sum (s .get ('type' ) == 'null' for s in any_of ) == 1 :
317
316
# If anyOf is a single type and null, then it is optional
Original file line number Diff line number Diff line change @@ -479,11 +479,11 @@ class SelectEnum(str, enum.Enum):
479
479
480
480
class FormSelectMultiple (BaseModel ):
481
481
select_single : SelectEnum = Field (title = 'Select Single' , description = 'first field' )
482
- select_single_2 : SelectEnum = Field (title = 'Select Single' ) # unset description
482
+ select_single_2 : SelectEnum = Field (title = 'Select Single' ) # unset description to test leakage from prev. field
483
483
select_multiple : List [SelectEnum ] = Field (title = 'Select Multiple' , description = 'third field' )
484
484
485
485
486
- def test_form_select_multiple ():
486
+ def test_form_description_leakage ():
487
487
m = components .ModelForm (model = FormSelectMultiple , submit_url = '/foobar/' )
488
488
489
489
assert m .model_dump (by_alias = True , exclude_none = True ) == {
You can’t perform that action at this time.
0 commit comments