42
42
from .utils import parse_and_store_tags
43
43
from .utils import parse_method
44
44
from .utils import parse_parameters
45
+ from .utils import run_validate_response
45
46
from .view import APIView
46
47
47
48
@@ -64,6 +65,7 @@ def __init__(
64
65
doc_prefix : str = "/openapi" ,
65
66
doc_url : str = "/openapi.json" ,
66
67
validate_response : Optional [bool ] = None ,
68
+ validate_response_callback : Callable = run_validate_response ,
67
69
** kwargs : Any
68
70
) -> None :
69
71
"""
@@ -97,6 +99,7 @@ def __init__(
97
99
doc_url: URL for accessing the OpenAPI specification document in JSON format.
98
100
Defaults to "/openapi.json".
99
101
validate_response: Verify the response body.
102
+ validate_response_callback: Validation and return response.
100
103
**kwargs: Additional kwargs to be passed to Flask.
101
104
"""
102
105
super (OpenAPI , self ).__init__ (import_name , ** kwargs )
@@ -148,6 +151,7 @@ def __init__(
148
151
149
152
# Verify the response body
150
153
self .validate_response = validate_response
154
+ self .validate_response_callback = validate_response_callback
151
155
152
156
# Initialize specification JSON
153
157
self .spec_json : dict = {}
0 commit comments