1818 _extract_endpoint_info_from_component_name ,
1919 _find_missing_upload_file_components ,
2020 _generate_component_title ,
21- fix_upload_file_schema_references ,
21+ ensure_upload_file_schema_references ,
2222)
2323
2424
@@ -52,7 +52,7 @@ def upload_file(file: Annotated[UploadFile, File()]):
5252 schema = app .get_openapi_schema ()
5353 # Convert to dict for processing by fix function
5454 schema_dict = schema .model_dump ()
55- fix_upload_file_schema_references (schema_dict )
55+ ensure_upload_file_schema_references (schema_dict )
5656
5757 # Verify components exist and are processed
5858 assert "components" in schema_dict
@@ -113,12 +113,12 @@ def test_schema_fix_edge_cases(self):
113113 """Test schema fix function edge cases."""
114114 # Test with empty schema
115115 empty_schema = {}
116- fix_upload_file_schema_references (empty_schema )
116+ ensure_upload_file_schema_references (empty_schema )
117117 assert empty_schema == {}
118118
119119 # Test with schema missing components
120120 schema_no_components = {"paths" : {}}
121- fix_upload_file_schema_references (schema_no_components )
121+ ensure_upload_file_schema_references (schema_no_components )
122122 # Should not crash and may or may not add components
123123
124124 def test_upload_file_multipart_handling (self ):
@@ -131,7 +131,7 @@ def upload_multiple(primary: Annotated[UploadFile, File()], secondary: Annotated
131131
132132 schema = app .get_openapi_schema ()
133133 schema_dict = schema .model_dump ()
134- fix_upload_file_schema_references (schema_dict )
134+ ensure_upload_file_schema_references (schema_dict )
135135
136136 # Verify multipart handling works without errors
137137 assert schema_dict is not None
@@ -226,7 +226,7 @@ def test_file_parameter_json_schema_extra(self):
226226 assert file_param .description == "Test file"
227227 assert hasattr (file_param , "json_schema_extra" )
228228
229- def test_fix_upload_file_schema_references_complex (self ):
229+ def test_ensure_upload_file_schema_references_complex (self ):
230230 """Test schema fix with complex schema structures."""
231231 # Test with pydantic model that has model_dump method
232232 mock_schema = Mock ()
@@ -246,7 +246,7 @@ def test_fix_upload_file_schema_references_complex(self):
246246 }
247247
248248 # Test fix function with model that has model_dump
249- fix_upload_file_schema_references (mock_schema )
249+ ensure_upload_file_schema_references (mock_schema )
250250 mock_schema .model_dump .assert_called_once_with (by_alias = True )
251251
252252 def test_extract_endpoint_info_from_component_name (self ):
@@ -341,7 +341,7 @@ def test_schema_dict_model_dump_handling(self):
341341 mock_schema .model_dump .return_value = {"paths" : {}, "components" : {"schemas" : {}}}
342342
343343 # This should call model_dump and process the result
344- fix_upload_file_schema_references (mock_schema )
344+ ensure_upload_file_schema_references (mock_schema )
345345 mock_schema .model_dump .assert_called_once_with (by_alias = True )
346346
347347 def test_openapi_validation_webkit_boundary_extraction (self ):
0 commit comments