mirror of
https://github.com/correl/openapi-core.git
synced 2025-01-01 11:03:19 +00:00
README validation description minor changes
This commit is contained in:
parent
7249858dfc
commit
6b639b9e34
1 changed files with 11 additions and 5 deletions
16
README.rst
16
README.rst
|
@ -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:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue