-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
aiohttp.web | ||
=========== | ||
|
||
This section describes integration with `aiohttp.web <https://docs.aiohttp.org/en/stable/web.html>`__ framework. | ||
|
||
Low level | ||
--------- | ||
|
||
You can use ``AIOHTTPOpenAPIWebRequest`` as an aiohttp request factory: | ||
|
||
.. code-block:: python | ||
from openapi_core import unmarshal_request | ||
from openapi_core.contrib.aiohttp import AIOHTTPOpenAPIWebRequest | ||
request_body = await aiohttp_request.text() | ||
openapi_request = AIOHTTPOpenAPIWebRequest(aiohttp_request, body=request_body) | ||
result = unmarshal_request(openapi_request, spec=spec) | ||
You can use ``AIOHTTPOpenAPIWebRequest`` as an aiohttp response factory: | ||
|
||
.. code-block:: python | ||
from openapi_core import unmarshal_response | ||
from openapi_core.contrib.starlette import AIOHTTPOpenAPIWebRequest | ||
openapi_response = StarletteOpenAPIResponse(aiohttp_response) | ||
result = unmarshal_response(openapi_request, openapi_response, spec=spec) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Integrations | ||
============ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
aiohttp | ||
werkzeug | ||
|
||
Openapi-core integrates with your popular libraries and frameworks. Each integration offers different levels of integration that help validate and unmarshal your request and response data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Werkzeug | ||
======== | ||
|
||
This section describes integration with `Werkzeug <https://werkzeug.palletsprojects.com>`__ a WSGI web application library. | ||
|
||
Low level | ||
~~~~~~~~~ | ||
|
||
The integration defines ``WerkzeugOpenAPIRequest`` and ``WerkzeugOpenAPIResponse`` classes that convert | ||
Werkzeug requests and responses to OpenAPI ones. | ||
|
||
.. md-tab-set:: | ||
|
||
.. md-tab-item:: Request | ||
|
||
.. code-block:: python | ||
from openapi_core.contrib.werkzeug import WerkzeugOpenAPIRequest | ||
openapi_request = WerkzeugOpenAPIRequest(werkzeug_request) | ||
result = openapi.unmarshal_request(openapi_request) | ||
.. md-tab-item:: Response | ||
|
||
.. code-block:: python | ||
from openapi_core.contrib.werkzeug import WerkzeugOpenAPIRequest, WerkzeugOpenAPIResponse | ||
openapi_request = WerkzeugOpenAPIRequest(werkzeug_request) | ||
openapi_response = WerkzeugOpenAPIResponse(werkzeug_response) | ||
result = openapi.unmarshal_response(openapi_request, openapi_response) |