Closed rafaelcapucho closed 3 months ago
Could you try 9f4455a1363c6edd2b23b898c554e52a9ce6d00f?
Could you try 9f4455a?
I was not successful using validate_response
with a list when the route returned an empty list, until I tried this branch and used List
instead of list
. Any idea when this will be released? Can I contribute?
Same result here with validate_response
decorator. That's the traceback I get:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1376, in handle_request
return await self.full_dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1414, in full_dispatch_request
result = await self.handle_user_exception(error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1007, in handle_user_exception
raise error
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1412, in full_dispatch_request
result = await self.dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1506, in dispatch_request
return await self.ensure_async(handler)(**request_.view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart_schema/extension.py", line 321, in openapi
return jsonify(_build_openapi_schema(current_app, self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart_schema/extension.py", line 657, in _build_openapi_schema
built_paths, components = _build_path(func, rule, app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart_schema/extension.py", line 490, in _build_path
schema = model_schema(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/quart_schema/conversion.py", line 205, in model_schema
or issubclass(model_class, BaseModel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen abc>", line 123, in __subclasscheck__
TypeError: issubclass() arg 1 must be a class
But it worked with your fix and list
or List
as type; thanks :slightly_smiling_face: Any suggestion of a release with this fix?
0.20.0 is released
The docs says that it is supported.
Model:
Views:
When I test with the![image](https://github.com/pgjones/quart-schema/assets/163367/40b9490c-696e-4253-ba4c-6371c9cc74c8)
/add
endpoint, it works:But when I test with the![image](https://github.com/pgjones/quart-schema/assets/163367/42a20d26-5a4c-4075-83fb-9daa8ff7d83f)
/add_list
endpoint, it fails:I also tested with
from typing import List
, I got the same result.Python:
3.12.2
Pip freeze: