File: response_unmarshaller_cls.rst

package info (click to toggle)
python-openapi-core 0.19.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,008 kB
  • sloc: python: 18,868; makefile: 47
file content (20 lines) | stat: -rw-r--r-- 674 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Response unmarshaller
=====================

In order to explicitly validate and unmarshal a:

* OpenAPI 3.0 spec, import ``V30ResponseUnmarshaller`` 
* OpenAPI 3.1 spec, import ``V31ResponseUnmarshaller`` or ``V31WebhookResponseUnmarshaller`` 

.. code-block:: python
  :emphasize-lines: 1,4

    from openapi_core import V31ResponseUnmarshaller

    config = Config(
       response_unmarshaller_cls=V31ResponseUnmarshaller,
    )
    openapi = OpenAPI.from_file_path('openapi.json', config=config)
    result = openapi.unmarshal_response(request, response)

You can also explicitly import ``V3ResponseUnmarshaller``  which is a shortcut to the latest OpenAPI v3 version.