File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,31 @@ or specify request wrapper class for shortcuts
103103 validated_body = validate_body(
104104 spec, request, wrapper_class = FlaskOpenAPIRequest)
105105
106+ You can also validate responses
107+
108+ .. code-block :: python
109+
110+ from openapi_core.validators import ResponseValidator
111+
112+ validator = ResponseValidator(spec)
113+ result = validator.validate(request, response)
114+
115+ # raise errors if response invalid
116+ result.raise_for_errors()
117+
118+ # get list of errors
119+ errors = result.errors
120+
121+ and unmarshal response data from validation result
122+
123+ .. code-block :: python
124+
125+ # get headers
126+ validated_headers = result.headers
127+
128+ # get data
129+ validated_data = result.data
130+
106131 Related projects
107132================
108133* `openapi-spec-validator <https://github.com/p1c2u/openapi-spec-validator >`__
You can’t perform that action at this time.
0 commit comments