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
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(self, fields, flex_options)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| fields | yes | |||
| flex_options | yes |
Source
server/vueda/core/serializers/__init__.py:587
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(self)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes |
Returns
list
Source
server/vueda/core/serializers/__init__.py:608
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(self, expands)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| expands | yes |
Source
server/vueda/core/serializers/__init__.py:697
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(self)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes |
Source
server/vueda/core/serializers/__init__.py:718
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(self, fields)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| fields | yes |
Source
server/vueda/core/serializers/__init__.py:706
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(self)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes |
Source
server/vueda/core/serializers/__init__.py:855
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(self)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes |
Source
server/vueda/core/serializers/__init__.py:865
get_schema_operation_parameters
Signature
get_schema_operation_parameters(self, operation_id, parameters)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| operation_id | yes | |||
| parameters | yes |
Source
server/vueda/core/serializers/__init__.py:746
serialize_display_choices
Return model-info display_choices entries from a display-choice declaration.
Signature
serialize_display_choices(choices)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| choices | yes |
Source
server/vueda/core/serializers/__init__.py:729
field_display_choices
Source
server/vueda/core/serializers/__init__.py:578