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

# VuedaExpandableFieldsSerializerMixin

## Overview

Serializer mixin that builds structured metadata about expandable fields for the
``/info/`` meta-API and OpenAPI schema. Automatically omits ``available_actions``
from nested expand representations.

## `apply_flex_fields` {#apply_flex_fields}

Omit ``available_actions`` from every expanded object.

Each requested expand name gains a ``<name>.available_actions`` omit. A next-level omit on a
name also keeps that name from being dropped by a top-level ``?om=``, as flex-fields treats
it as an omit inside the expanded object rather than of the object itself.

A wildcard expand resolves to the declared expandable names first, as flex-fields does, so each
expanded serializer receives the omit. Names the request omits get no nested omit, so a
top-level ``?om=`` still drops them from a wildcard expand.

### Signature {#apply_flex_fields-signature}

`apply_flex_fields(self, fields, flex_options)`

#### Parameters {#apply_flex_fields-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |
| <span id="apply_flex_fields-param-fields">fields</span> |  | yes |  |  |
| <span id="apply_flex_fields-param-flex_options">flex_options</span> |  | yes |  |  |

### Source {#apply_flex_fields-source}

`server/vueda/core/serializers/__init__.py:587`

## `generate_expand_model_info` {#generate_expand_model_info}

Build the base list of expand descriptors for the ``/info/`` meta-API from
``Meta.expandable_fields``. This is the internal generation step; serializers that need to
customize the final expand metadata should override ``get_expand_model_info`` instead.

### Signature {#generate_expand_model_info-signature}

`generate_expand_model_info(self)`

#### Parameters {#generate_expand_model_info-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |

#### Returns {#generate_expand_model_info-returns}

`list`

### Source {#generate_expand_model_info-source}

`server/vueda/core/serializers/__init__.py:608`

## `get_expand_model_info` {#get_expand_model_info}

Customization hook for the ``model_expands`` metadata the ``/info/`` meta-API returns for this
serializer. Receives the generated list of expand descriptors and must return a list in the same
shape; override to add or adjust entries, such as the real type of a ``SerializerMethodField``.
The default implementation returns ``expands`` unchanged.

### Signature {#get_expand_model_info-signature}

`get_expand_model_info(self, expands)`

#### Parameters {#get_expand_model_info-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |
| <span id="get_expand_model_info-param-expands">expands</span> |  | yes |  |  |

### Source {#get_expand_model_info-source}

`server/vueda/core/serializers/__init__.py:697`

## `get_field_display_choices` {#get_field_display_choices}

Return display-only label mappings for serializer fields.

``field_display_choices`` should be keyed by serializer field name. Each value may be either a
mapping of ``{stored_value: label}``, an iterable of ``(stored_value, label)`` pairs, or an
iterable of objects with ``value`` and ``label`` keys. These labels affect read-only display
metadata only; they do not change validation choices or editable widgets.

### Signature {#get_field_display_choices-signature}

`get_field_display_choices(self)`

#### Parameters {#get_field_display_choices-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |

### Source {#get_field_display_choices-source}

`server/vueda/core/serializers/__init__.py:718`

## `get_field_model_info` {#get_field_model_info}

Customization hook for the ``model_fields`` metadata the ``/info/`` meta-API returns for this
serializer. Receives the generated field metadata dict (keyed by field name) and must return a
dict in the same shape; override to correct or add entries, such as the real type of a
``SerializerMethodField``. The default implementation applies ``field_display_choices``.

### Signature {#get_field_model_info-signature}

`get_field_model_info(self, fields)`

#### Parameters {#get_field_model_info-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |
| <span id="get_field_model_info-param-fields">fields</span> |  | yes |  |  |

### Source {#get_field_model_info-source}

`server/vueda/core/serializers/__init__.py:706`

## `get_schema_expandable_fields` {#get_schema_expandable_fields}

Build the ``expand`` query parameter's documented values for the OpenAPI schema, reusing the same
generation (``generate_expand_model_info``) and customization hook (``get_expand_model_info``) the
``/info/`` meta-API uses for ``model_expands``, then reducing the result to what the schema needs.

### Signature {#get_schema_expandable_fields-signature}

`get_schema_expandable_fields(self)`

#### Parameters {#get_schema_expandable_fields-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |

### Source {#get_schema_expandable_fields-source}

`server/vueda/core/serializers/__init__.py:855`

## `get_schema_fields` {#get_schema_fields}

Build this serializer's own field metadata for OpenAPI schema purposes, mirroring how ``model_fields``
is generated for the ``/info/`` meta-API: inspect the serializer's own fields with
``ModelInfoSerializer.get_model_fields_data``, then run the result through ``get_field_model_info`` so
a serializer that already corrects a ``SerializerMethodField``'s metadata for ``/info/`` gets the same
correction reflected in its schema, then reduce to the keys the schema needs. Returns an empty dict when
this serializer has no ``Meta.model`` to inspect.

Passes ``self.context`` along so ``get_model_fields_data`` re-instantiates this *same* serializer
class with the view already in context (rather than bare) -- this is describing this serializer's
own fields, not another serializer's, so reusing ``self``'s context here is always correct.

### Signature {#get_schema_fields-signature}

`get_schema_fields(self)`

#### Parameters {#get_schema_fields-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |

### Source {#get_schema_fields-source}

`server/vueda/core/serializers/__init__.py:865`

## `get_schema_operation_parameters` {#get_schema_operation_parameters}

### Signature {#get_schema_operation_parameters-signature}

`get_schema_operation_parameters(self, operation_id, parameters)`

#### Parameters {#get_schema_operation_parameters-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |
| <span id="get_schema_operation_parameters-param-operation_id">operation_id</span> |  | yes |  |  |
| <span id="get_schema_operation_parameters-param-parameters">parameters</span> |  | yes |  |  |

### Source {#get_schema_operation_parameters-source}

`server/vueda/core/serializers/__init__.py:746`

## `serialize_display_choices` {#serialize_display_choices}

Return model-info ``display_choices`` entries from a display-choice declaration.

### Signature {#serialize_display_choices-signature}

`serialize_display_choices(choices)`

#### Parameters {#serialize_display_choices-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="serialize_display_choices-param-choices">choices</span> |  | yes |  |  |

### Source {#serialize_display_choices-source}

`server/vueda/core/serializers/__init__.py:729`

## `field_display_choices` {#field_display_choices}

## Source

`server/vueda/core/serializers/__init__.py:578`
