diff --git a/README.rst b/README.rst index 27f8a2c..6362a27 100644 --- a/README.rst +++ b/README.rst @@ -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 `__ diff --git a/openapi_core/__init__.py b/openapi_core/__init__.py index 5909c4a..235d5ed 100644 --- a/openapi_core/__init__.py +++ b/openapi_core/__init__.py @@ -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()