Implementing Custom DTO Classes#
While Litestar maintains a suite of DTO factories, it is possible to create your own DTOs. To do so, you must implement
The following is a description of the methods of the protocol, and how they are used by Litestar. For detailed
information on the signature of each method, see the
These methods must be implemented on any
This method receives the model type for the DTO and it should return a generator yielding
DTOFieldDefinition instances corresponding with
the model fields.
This method receives a
FieldDefinition instance and it should return a boolean
indicating whether the field is a nested model field.