-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment:
- Python version: 312
- Operating system:
- Flask version:
- flask-openapi3 version:
This affects all versions. Flask-openapi3 removes all arguments passed to the view by any previous callers -- such as Dependency Injection frameworks, breaking things in the meanwhile.
In request._validate_request
all arguments kwargs are removed as they are treated as path args. This is however not always a correct assumption as views from flask-openapi3 may be decorated again before being passed onto flask.
In this case flask calls the views decorated elsewhere which supply some arguments to flask-openapi3 which then simply removes them instead of passing them down. There are a few flask extensions which do this as well.
In the below example the call chain is as follows flask -> inject_services -> flask_openapi3
.
Example:
@app.get("/greet")
def view(greeter: GreeterService, query: GreetQuery):
return greeter.greet(query.name)
...
# Automatically decorate all flask views so that known services are passed down.
app.view_functions = {k: inject_services(v) for k, v in app.view_functions.items()}
...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working