Right now https://docs.litestar.dev/latest/usage/dto/0-basic-use.html starts with:
and I was like: wait a second!
Here we demonstrate how to declare DTO types to your route handlers.
For demonstration purposes, we assume that we are working with a data model User, and already have two DTO types created in our application, UserDTO, and UserReturnDTO.
So, do we demonstrate how to declare them? Or do we have them already declared?
Let's go further: https://docs.litestar.dev/latest/usage/dto/0-basic-use.html#defining-dtos-on-handlers
What does this example show users?
from litestar import post
from .models import User, UserDTO
@post(dto=UserDTO)
def create_user(data: User) -> User:
return data
When I was reading it - I had no idea what User
is, what UserDTO
is, why do I need to use dto=
at all.
I propose to refactor the first half of this guide, because right now it is really hard to understand.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too