Merge pull request #4 from p1c2u/feature/usage-documentation

Usage documentation
This commit is contained in:
A 2017-09-22 10:19:08 +01:00 committed by GitHub
commit 86ebeb4599
2 changed files with 26 additions and 1 deletions

View file

@ -35,6 +35,27 @@ Alternatively you can download the code and install from the repository:
$ pip install -e git+https://github.com/p1c2u/openapi-core.git#egg=openapi_core
Usage
=====
Firstly create your specification:
.. code-block:: python
from openapi_core import create_spec
spec = create_spec(spec_dict)
Now you can use it to validate and unmarshal requests
.. code-block:: python
from openapi_core import request_parameters_factory, request_body_factory
parameters = request_parameters_factory.create(request, spec)
body = request_body_factory.create(request, spec)
Related projects
================
* `openapi-spec-validator <https://github.com/p1c2u/openapi-spec-validator>`__

View file

@ -1,5 +1,6 @@
"""OpenAPI core module"""
from openapi_core.shortcuts import create_spec
from openapi_core.wrappers import RequestParametersFactory, RequestBodyFactory
__author__ = 'Artur Maciąg'
__email__ = 'maciag.artur@gmail.com'
@ -7,4 +8,7 @@ __version__ = '0.0.1'
__url__ = 'https://github.com/p1c2u/openapi-core'
__license__ = 'BSD 3-Clause License'
__all__ = ['create_spec', ]
__all__ = ['create_spec', 'request_parameters_factory', 'request_body_factory']
request_parameters_factory = RequestParametersFactory()
request_body_factory = RequestBodyFactory()