-
-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It looks like connexion 1.1.6 broke compatibility with flask-injector. #469
Comments
Thanks for the information, did not know about that! |
Will you be able to fix this? |
@tjhgit Are you willing to do a PR to fix this? |
Hey all, I'm in the process of debugging this so might as well send a PR when I know what's going on. |
Unfortunately I'm not familiar with connexion enough to create a proper automated test (required for a PR as far as I'm concerned) but I was able to verify a patch to connexion against a simple test case and it works. This is the patch: diff --git a/connexion/decorators/parameter.py b/connexion/decorators/parameter.py
index 54734d8..906163b 100644
--- a/connexion/decorators/parameter.py
+++ b/connexion/decorators/parameter.py
@@ -142,6 +142,12 @@ def parameter_to_arg(parameters, consumes, function, pythonic_params=False):
logger.debug("Body parameter '%s' in function arguments", body_name)
kwargs[body_name] = request_body
+ for key, value in path_params.items():
+ if key not in kwargs:
+ kwargs[key] = value
+
# Add query parameters
query_arguments = copy.deepcopy(default_query_params)
query_arguments.update({sanitize_param(k): v for k, v in request.query.items()}) The issue is that keyword arguments to views are silently discarded if they don't correspond to named URL placeholders which interferes with Flask-Injector because Flask-Injector uses exactly that mechanism to provide dependencies. I hope someone can use the patch above and create a proper connexion change (if it's determined to be desired). |
I can replicate this issue in 1.1.13 as well. This issue is not present in 1.1.5 |
I can replicate this on 1.1.9. Is anyone working on this? I can take a crack at it. Is it a matter of taking the patch above and writing some tests for it? (The patch works for me) |
@dcarrot2 go ahead 😄 |
Still have this problem with connexion v1.3 |
False alert. Issue solved by specifying arguments names in binder
|
Description
This code https://medium.com/@ssola/building-microservices-with-python-part-i-5240a8dcc2fb section working with Flask Injector does not work.
Expected behaviour
Should work
Actual behaviour
Error message:
TypeError: search() missing 1 required positional argument: 'data_provider'
Steps to reproduce
use connexion 1.1.6 or higher in requirements.txt
Additional info:
Output of the commands:
python --version
3.6
pip show connexion | grep "^Version\:"
The text was updated successfully, but these errors were encountered: