I am working on refactoring a flask app which uses connexion package for the RESTful API. Previously the code base was function based and I`m refactoring it with some OOP design principles.
app = connexion.App(__name__)
app.add_api(
os.path.join(global_variables.ROOT_DIR, "openapi.yaml"),
pythonic_params=True,
validate_responses=VALIDATE_RESPONSES,
validator_map={"parameter": request_parameter_validator.RequestParameterValidator},
)
In the openapi.yaml
the operationId
specifies the full path to the class method which handles the request, but it throws the error:
TypeError: be_autocomplete_handler() missing 1 required positional argument: 'self'
How can I create an instance of that class in this case and pass it in the parameters
field? Also, I do not pass any parameters in the constructor for now.
However, is there a preferred workflow in this case? Rather than creating an object instance?