Replies: 1 comment
-
@peterschutt do you have an idea here? Trying to go through older issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
EDIT: Note that I'm still running under starlite and haven't migrated to litestar yet...
There's probably something obvious I'm missing or not understanding...
In the documentation, there is an example:
https://docs.litestar.dev/latest/usage/dto.html#add-new-fields
However, you can never use the from_model_instance on the DTO as it has a required field that can't be injected:
Is there a way to add extra arguments without making them optional? Something like:
For context, my model is an sqlalchemy table and I would like to add some calculated fields before being returned to the route. They don't have default values and I'd like to make them required so that they are documented/validated correctly.
Beta Was this translation helpful? Give feedback.
All reactions