mirror of
https://github.com/correl/openapi-core.git
synced 2025-03-19 17:00:09 -09:00
README updated with request validation
This commit is contained in:
parent
9bdb13f654
commit
e85d2d9f8a
1 changed files with 13 additions and 3 deletions
16
README.rst
16
README.rst
|
@ -51,10 +51,20 @@ Now you can use it to validate and unmarshal requests
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from openapi_core import request_parameters_factory, request_body_factory
|
||||
from openapi_core.validators import RequestValidator
|
||||
|
||||
parameters = request_parameters_factory.create(request, spec)
|
||||
body = request_body_factory.create(request, spec)
|
||||
validator = RequestValidator(spec)
|
||||
result = validator.validate(request)
|
||||
|
||||
# raise errors if request invalid
|
||||
result.validate()
|
||||
|
||||
# get parameters
|
||||
path_params = result.parameters['path']
|
||||
query_params = result.parameters['query']
|
||||
|
||||
# get body
|
||||
body = result.body
|
||||
|
||||
Related projects
|
||||
================
|
||||
|
|
Loading…
Add table
Reference in a new issue