Adding an optional parameter error_handler_params in Flask Decorator to provide data to Error handler class.
The parameter is basically a dictionary which is passed to constructor of error handler class,
and if it is not passed, then nothing is passed in the constructor.
Kindly note the constructor of openapi error handler
def __init__(self, input_param:dict):
whatever custom input is passed is accessed through input_param parameter.
int input_param is a dictionary and stores custom data in custom key/value format.
this custom input can be passed whenever we create new openapi_core decorator object as shown in above example
FlaskOpenAPIViewDecorator.from_spec(spec_object, openapi_errors_handler=MyCustomErrorHandler, error_handler_params={"title" : "Failed to execute test API"})
as we can see the dictionary {"title" : "Failed to execute test API"} is passed to error handler constructor and is accessed within the code
Adding an optional parameter
error_handler_params
in Flask Decorator to provide data to Error handler class.The parameter is basically a dictionary which is passed to constructor of error handler class, and if it is not passed, then nothing is passed in the constructor.
This PR implements following feature request https://github.com/python-openapi/openapi-core/issues/910
Consider below example for understanding usage of this flag
Following is test.yaml
Kindly note the constructor of openapi error handler
whatever custom input is passed is accessed through input_param parameter.
int input_param is a dictionary and stores custom data in custom key/value format.
this custom input can be passed whenever we create new openapi_core decorator object as shown in above example
as we can see the dictionary
{"title" : "Failed to execute test API"}
is passed to error handler constructor and is accessed within the code