Manage dict used as 'additionalProperties'#104
Manage dict used as 'additionalProperties'#104MathieuAvila wants to merge 1 commit intoDorthu:masterfrom
Conversation
|
Humn this seems to be a duplicate of #63 , except that my understanding is that additionalProperties is used to create a dictionary. |
|
Reading back over #63, I think this needs to accept a The previous PR was very close to the intended behavior, and it might be better to start there and build out the features it was missing. |
|
Ok, closing this and will look at #63. My goal was to be compatible with fastapi's dict serialization, but it seems we have to interpret the specs a little. |
Sorry, I was unable to test nor write unit test. I get the following error, tell me how to fix and I'll write the associated UT.
============================================================================================== ERRORS =============================================================================================== ______________________________________________________________________________ ERROR collecting tests/fastapi_test.py _______________________________________________________________________________ tests/fastapi_test.py:15: in <module> from api.main import app tests/api/main.py:59: in <module> def getPet(pet_id: int = Query(..., alias='petId')) -> Pets: ../.local/lib/python3.10/site-packages/fastapi/routing.py:706: in decorator self.add_api_route( ../.local/lib/python3.10/site-packages/fastapi/routing.py:645: in add_api_route route = route_class( ../.local/lib/python3.10/site-packages/fastapi/routing.py:491: in __init__ self.dependant = get_dependant(path=self.path_format, call=self.endpoint) ../.local/lib/python3.10/site-packages/fastapi/dependencies/utils.py:261: in get_dependant type_annotation, depends, param_field = analyze_param( ../.local/lib/python3.10/site-packages/fastapi/dependencies/utils.py:410: in analyze_param assert isinstance(field_info, params.Path), ( E AssertionError: Cannot useQueryfor path param 'pet_id' ====================================================================================== short test summary info ====================================================================================== ERROR tests/fastapi_test.py - AssertionError: Cannot useQueryfor path param 'pet_id' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ========================================================================================= 1 error in 0.49s ==========================================================================================