File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 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(
310310 if def_schema is None :
311311 raise ValueError (f'Invalid $ref "{ ref } ", not found in { defs } ' )
312312 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
315314 elif any_of := schema .get ('anyOf' ):
316315 if len (any_of ) == 2 and sum (s .get ('type' ) == 'null' for s in any_of ) == 1 :
317316 # 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):
479479
480480class FormSelectMultiple (BaseModel ):
481481 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
483483 select_multiple : List [SelectEnum ] = Field (title = 'Select Multiple' , description = 'third field' )
484484
485485
486- def test_form_select_multiple ():
486+ def test_form_description_leakage ():
487487 m = components .ModelForm (model = FormSelectMultiple , submit_url = '/foobar/' )
488488
489489 assert m .model_dump (by_alias = True , exclude_none = True ) == {
You can’t perform that action at this time.
0 commit comments