dataclass_dto#

class litestar.dto.dataclass_dto.DataclassDTO#

Bases: AbstractDTO, Generic[T]

Support for domain modelling with dataclasses.

classmethod generate_field_definitions(model_type: type[DataclassProtocol]) Generator[DTOFieldDefinition, None, None]#

Generate FieldDefinition instances from model_type.

Yields:

FieldDefinition instances.

classmethod detect_nested_field(field_definition: FieldDefinition) bool#

Return True if field_definition represents a nested model field.

Parameters:

field_definition – inspect type to determine if field represents a nested model.

Returns:

True if field_definition represents a nested model field.