Skip to main content

ComputedField

No overview available.

Attributes

AttributeTypeDescription
property_namePyBackedStrThe name of the Python property or method that provides the computed value.
serializerArc< CombinedSerializer >The internal serializer instance used to convert the computed field's output into a serializable format.
aliasPyBackedStrThe public name used for the field during serialization, which may differ from the internal property name.
serialize_by_aliasboolDetermines whether the field should be serialized using its alias instead of its property name when an alias is defined.
serialization_exclude_ifPy< 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

NameTypeDescription
property_namePyBackedStrThe name of the property on the model.
serializerArc< CombinedSerializer >The serializer instance used to process the field value.
aliasPyBackedStrThe public name used for the field during serialization.
serialize_by_aliasOption< bool >Whether to use the alias name when serializing the field.
serialization_exclude_ifOption< 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

TypeDescription
PyBackedStrThe 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

TypeDescription
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

TypeDescription
PyBackedStrThe 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

TypeDescription
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

TypeDescription
Option< Py< PyAny > >A reference to a Python object representing the exclusion condition, or null if no condition is set.