---
url: "https://vueda.dev/v3/reference/api/py/vueda.core.open_api.md"
title: "core.open_api"
---

# core.open_api

## Overview

Conditional drf-spectacular wrappers for OpenAPI schema generation.

## Classes

- [AlwaysGetNone](/v3/reference/api/py/vueda.core.open_api/AlwaysGetNone.md)
- [OpenApiDocsGenerationObjectIdModel](/v3/reference/api/py/vueda.core.open_api/OpenApiDocsGenerationObjectIdModel.md)
- [VuedaBaseAutoSchema](/v3/reference/api/py/vueda.core.open_api/VuedaBaseAutoSchema.md)

## `conditional_extend_schema_decorator` {#conditional_extend_schema_decorator}

Return a decorator that applies drf-spectacular's ``extend_schema``, or returns the decorated
function unchanged when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_decorator-signature}

`conditional_extend_schema_decorator(args, kwargs)`

#### Parameters {#conditional_extend_schema_decorator-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_decorator-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_decorator-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_decorator-source}

`server/vueda/core/open_api.py:47`

## `conditional_extend_schema_field_decorator` {#conditional_extend_schema_field_decorator}

Return a decorator that applies drf-spectacular's ``extend_schema_field``, or returns the decorated
function unchanged when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_field_decorator-signature}

`conditional_extend_schema_field_decorator(args, kwargs)`

#### Parameters {#conditional_extend_schema_field_decorator-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_field_decorator-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_field_decorator-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_field_decorator-source}

`server/vueda/core/open_api.py:69`

## `conditional_extend_schema_field_func` {#conditional_extend_schema_field_func}

Return drf-spectacular's ``extend_schema_field`` decorator built from the arguments, or ``None``
when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_field_func-signature}

`conditional_extend_schema_field_func(args, kwargs)`

#### Parameters {#conditional_extend_schema_field_func-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_field_func-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_field_func-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_field_func-source}

`server/vueda/core/open_api.py:149`

## `conditional_extend_schema_func` {#conditional_extend_schema_func}

Return drf-spectacular's ``extend_schema`` decorator built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_extend_schema_func-signature}

`conditional_extend_schema_func(args, kwargs)`

#### Parameters {#conditional_extend_schema_func-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_func-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_func-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_func-source}

`server/vueda/core/open_api.py:136`

## `conditional_extend_schema_serializer_decorator` {#conditional_extend_schema_serializer_decorator}

Return a decorator that applies drf-spectacular's ``extend_schema_serializer``, or returns the
decorated class unchanged when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_serializer_decorator-signature}

`conditional_extend_schema_serializer_decorator(args, kwargs)`

#### Parameters {#conditional_extend_schema_serializer_decorator-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_serializer_decorator-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_serializer_decorator-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_serializer_decorator-source}

`server/vueda/core/open_api.py:91`

## `conditional_extend_schema_serializer_func` {#conditional_extend_schema_serializer_func}

Return drf-spectacular's ``extend_schema_serializer`` decorator built from the arguments, or
``None`` when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_serializer_func-signature}

`conditional_extend_schema_serializer_func(args, kwargs)`

#### Parameters {#conditional_extend_schema_serializer_func-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_serializer_func-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_serializer_func-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_serializer_func-source}

`server/vueda/core/open_api.py:162`

## `conditional_extend_schema_view_decorator` {#conditional_extend_schema_view_decorator}

Return a decorator that applies drf-spectacular's ``extend_schema_view``, or returns the decorated
view unchanged when drf-spectacular is not installed.

### Signature {#conditional_extend_schema_view_decorator-signature}

`conditional_extend_schema_view_decorator(args, kwargs)`

#### Parameters {#conditional_extend_schema_view_decorator-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_view_decorator-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_view_decorator-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_view_decorator-source}

`server/vueda/core/open_api.py:113`

## `conditional_extend_schema_view_func` {#conditional_extend_schema_view_func}

Return drf-spectacular's ``extend_schema_view`` decorator built from the arguments, or ``None`` when
drf-spectacular is not installed.

### Signature {#conditional_extend_schema_view_func-signature}

`conditional_extend_schema_view_func(args, kwargs)`

#### Parameters {#conditional_extend_schema_view_func-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_extend_schema_view_func-param-args">args</span> |  | no |  |  |
| <span id="conditional_extend_schema_view_func-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_extend_schema_view_func-source}

`server/vueda/core/open_api.py:175`

## `conditional_inline_serializer` {#conditional_inline_serializer}

Return a serializer built by drf-spectacular's ``inline_serializer``, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_inline_serializer-signature}

`conditional_inline_serializer(args, kwargs)`

#### Parameters {#conditional_inline_serializer-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_inline_serializer-param-args">args</span> |  | no |  |  |
| <span id="conditional_inline_serializer-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_inline_serializer-source}

`server/vueda/core/open_api.py:284`

## `conditional_open_api_callback` {#conditional_open_api_callback}

Return a drf-spectacular ``OpenApiCallback`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_callback-signature}

`conditional_open_api_callback(args, kwargs)`

#### Parameters {#conditional_open_api_callback-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_callback-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_callback-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_callback-source}

`server/vueda/core/open_api.py:240`

## `conditional_open_api_example` {#conditional_open_api_example}

Return a drf-spectacular ``OpenApiExample`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_example-signature}

`conditional_open_api_example(args, kwargs)`

#### Parameters {#conditional_open_api_example-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_example-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_example-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_example-source}

`server/vueda/core/open_api.py:188`

## `conditional_open_api_parameter` {#conditional_open_api_parameter}

Return a drf-spectacular ``OpenApiParameter`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_parameter-signature}

`conditional_open_api_parameter(args, kwargs)`

#### Parameters {#conditional_open_api_parameter-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_parameter-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_parameter-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_parameter-source}

`server/vueda/core/open_api.py:201`

## `conditional_open_api_request` {#conditional_open_api_request}

Return a drf-spectacular ``OpenApiRequest`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_request-signature}

`conditional_open_api_request(args, kwargs)`

#### Parameters {#conditional_open_api_request-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_request-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_request-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_request-source}

`server/vueda/core/open_api.py:227`

## `conditional_open_api_response` {#conditional_open_api_response}

Return a drf-spectacular ``OpenApiResponse`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_response-signature}

`conditional_open_api_response(args, kwargs)`

#### Parameters {#conditional_open_api_response-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_response-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_response-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_response-source}

`server/vueda/core/open_api.py:214`

## `conditional_open_api_types` {#conditional_open_api_types}

Return drf-spectacular's ``OpenApiTypes`` enum, or an ``AlwaysGetNone`` object whose attributes are
all ``None`` when drf-spectacular is not installed.

### Signature {#conditional_open_api_types-signature}

`conditional_open_api_types()`

### Source {#conditional_open_api_types-source}

`server/vueda/core/open_api.py:271`

## `conditional_open_api_webhook` {#conditional_open_api_webhook}

Return a drf-spectacular ``OpenApiWebhook`` built from the arguments, or ``None`` when drf-spectacular
is not installed.

### Signature {#conditional_open_api_webhook-signature}

`conditional_open_api_webhook(args, kwargs)`

#### Parameters {#conditional_open_api_webhook-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="conditional_open_api_webhook-param-args">args</span> |  | no |  |  |
| <span id="conditional_open_api_webhook-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#conditional_open_api_webhook-source}

`server/vueda/core/open_api.py:253`

## `get_components_by_ref` {#get_components_by_ref}

Return a deep copy of each component schema in ``components`` named by ``ref_strings``, keyed by ref
string.

Each ref string ends in ``/<component type>/<component name>``, as in ``#/components/schemas/Cart``.

### Signature {#get_components_by_ref-signature}

`get_components_by_ref(components, ref_strings)`

#### Parameters {#get_components_by_ref-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="get_components_by_ref-param-components">components</span> |  | yes |  |  |
| <span id="get_components_by_ref-param-ref_strings">ref_strings</span> |  | yes |  |  |

### Source {#get_components_by_ref-source}

`server/vueda/core/open_api.py:674`

## `recursive_replace_refs` {#recursive_replace_refs}

Replace each ``$ref`` in ``data`` that names a schema in ``refs_schema`` with that schema's keys, in
place, descending into nested dicts but not lists.

### Signature {#recursive_replace_refs-signature}

`recursive_replace_refs(data, refs_schema)`

#### Parameters {#recursive_replace_refs-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="recursive_replace_refs-param-data">data</span> |  | yes |  |  |
| <span id="recursive_replace_refs-param-refs_schema">refs_schema</span> |  | yes |  |  |

### Source {#recursive_replace_refs-source}

`server/vueda/core/open_api.py:693`

## `replace_refs_with_schema` {#replace_refs_with_schema}

Inline the component schemas named by ``component_ref_strings`` wherever ``data`` refers to them by
``$ref``, editing ``data`` in place.

Refs between those components are inlined first, so the copied schemas are self-contained.

### Signature {#replace_refs_with_schema-signature}

`replace_refs_with_schema(components, data, component_ref_strings)`

#### Parameters {#replace_refs_with_schema-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="replace_refs_with_schema-param-components">components</span> |  | yes |  |  |
| <span id="replace_refs_with_schema-param-data">data</span> |  | yes |  |  |
| <span id="replace_refs_with_schema-param-component_ref_strings">component_ref_strings</span> |  | yes |  |  |

### Source {#replace_refs_with_schema-source}

`server/vueda/core/open_api.py:709`

## Source

`server/vueda/core/open_api.py`
