From 6b639b9e34e59a7664350ebd098aa5dc0ec3929f Mon Sep 17 00:00:00 2001 From: Artur Maciag Date: Fri, 3 Nov 2017 14:49:57 +0000 Subject: [PATCH] README validation description minor changes --- README.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 79d1d21..efc9c7e 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ Firstly create your specification: 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 @@ -59,12 +59,18 @@ Now you can use it to validate and unmarshal requests # raise errors if request invalid result.validate() - # get parameters - path_params = result.parameters['path'] - query_params = result.parameters['query'] + # get list of errors + errors = result.errors + +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 - body = result.body + validated_body = result.body Request object should implement BaseOpenAPIRequest interface. You can use FlaskOpenAPIRequest a Flask/Werkzeug request wrapper implementation: