-
Hello, I'm finally upgrading some code from starlite -> litestar and I'm having an issue with a "grouped" object from old starlite code with the new SQLAlchemyDTO:
This complains that the response cannot be serialised because Foo isn't serlializable, which makes sense as that's what the DTO is for. If I swap the type to be I also had to add an arbitrary_types_allowed which makes me believe I'm on the wrong track... How would I achieve this in litestar? Before it would just magically convert using the dto_factory. Tested on a clean env Edit: Is there a way to convert in the route to get an instance of FooDTO from an instance of Foo so I can directly create a Bar? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I think you're looking for the pattern documented here: https://docs.litestar.dev/2/usage/dto/1-abstract-dto.html#wrapping-return-data
|
Beta Was this translation helpful? Give feedback.
I think you're looking for the pattern documented here: https://docs.litestar.dev/2/usage/dto/1-abstract-dto.html#wrapping-return-data