README validation description minor changes

This commit is contained in:
Artur Maciag 2017-11-03 14:49:57 +00:00
parent 7249858dfc
commit 6b639b9e34

View file

@ -47,7 +47,7 @@ Firstly create your specification:
spec = create_spec(spec_dict) spec = create_spec(spec_dict)
Now you can use it to validate and unmarshal requests Now you can use it to validate requests
.. code-block:: python .. code-block:: python
@ -59,12 +59,18 @@ Now you can use it to validate and unmarshal requests
# raise errors if request invalid # raise errors if request invalid
result.validate() result.validate()
# get parameters # get list of errors
path_params = result.parameters['path'] errors = result.errors
query_params = result.parameters['query']
and unmarshal request data from validation result
.. code-block:: python
# get parameters dictionary with path, query, cookies and headers parameters
validated_params = result.parameters
# get body # get body
body = result.body validated_body = result.body
Request object should implement BaseOpenAPIRequest interface. You can use FlaskOpenAPIRequest a Flask/Werkzeug request wrapper implementation: Request object should implement BaseOpenAPIRequest interface. You can use FlaskOpenAPIRequest a Flask/Werkzeug request wrapper implementation: