Open danielbprice opened 11 months ago
Thanks for the report @danielbprice.
These are not available because Connexion already consumes them. I agree that this is not ideal. I think it would be logical if Connexion only consumes them if you let Connexion inject them into your view function. This should be possible but requires some refactoring. For now, I added a warning to the docs in #1813.
Having the same problem here, but also added to the fact that our controller is autogenerated by Swagger, whose online_controller.py
functions are not async
:skull: . Our workaround that at least initiates the server but hangs forever when accessing the endpoint is as follows:
def my_endpoint(body): # noqa: E501
"""<endpoint description...>
"""
check_permission(PERMISSIONS)
if connexion.request.mimetype == "application/json":
body = asyncio.run(connexion.request.json())
return my_functions(body)
Description
I found that
connexion.request
does not appear to work the way the documentation implies. It seems to hang when async methods are called (I testedform()
andbody()
).Expected behaviour
Given:
And spec
Any request to this endpoint seems to hang. The docs seem to at least imply that it's OK to access these items:
Actual behaviour
I found https://github.com/encode/starlette/issues/495, which documents similar issues therein. I am not knowledgeable enough about the innards here to know if this is the same issue or not.
Steps to reproduce
See above.
Additional info:
Output of the commands:
python --version
Python 3.10.13
pip show connexion | grep "^Version\:"
3.0.1