ComputedField
No overview available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| property_name | PyBackedStr | The name of the Python property or method that provides the computed value. |
| serializer | Arc< CombinedSerializer > | The internal serializer instance used to convert the computed field's output into a serializable format. |
| alias | PyBackedStr | The public name used for the field during serialization, which may differ from the internal property name. |
| serialize_by_alias | bool | Determines whether the field should be serialized using its alias instead of its property name when an alias is defined. |
| serialization_exclude_if | Py< PyAny > | A Python callable or condition that determines if the field should be omitted from the serialized output. |
Constructor
Signature
def ComputedField(
property_name: PyBackedStr,
serializer: Arc< CombinedSerializer >,
alias: PyBackedStr,
serialize_by_alias: Option< bool >,
serialization_exclude_if: Option< Py< PyAny > >
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| property_name | PyBackedStr | The name of the property on the model. |
| serializer | Arc< CombinedSerializer > | The serializer instance used to process the field value. |
| alias | PyBackedStr | The public name used for the field during serialization. |
| serialize_by_alias | Option< bool > | Whether to use the alias name when serializing the field. |
| serialization_exclude_if | Option< Py< PyAny > > | A condition or value that determines if the field should be excluded from serialization. |
Methods
property_name()
def property_name() - > PyBackedStr
The name of the property on the Python object that will be accessed to retrieve the computed value.
Returns
| Type | Description |
|---|---|
PyBackedStr | The internal string representation of the property name. |
serializer()
def serializer() - > Arc< CombinedSerializer >
The serialization logic used to convert the computed field's value into its final output format.
Returns
| Type | Description |
|---|---|
Arc< CombinedSerializer > | An atomic reference-counted pointer to the combined serializer instance. |
alias()
def alias() - > PyBackedStr
The public-facing name used for the field during serialization, often used to map internal names to external API requirements.
Returns
| Type | Description |
|---|---|
PyBackedStr | The string alias assigned to the computed field. |
serialize_by_alias()
def serialize_by_alias() - > Option< bool >
Determines whether the field should be serialized using its alias instead of its internal property name.
Returns
| Type | Description |
|---|---|
Option< bool > | A boolean flag indicating alias preference, or null if not explicitly configured. |
serialization_exclude_if()
def serialization_exclude_if() - > Option< Py< PyAny > >
Defines a Python callable or condition that determines if the field should be omitted from the serialized output.
Returns
| Type | Description |
|---|---|
Option< Py< PyAny > > | A reference to a Python object representing the exclusion condition, or null if no condition is set. |