Skip to content

Question: How to make litestar apply msgspec custom enc_hook / dec_hook functions to serialize/deserialize custom types? #3584

Answered by provinzkraut
stewit asked this question in Q&A
Discussion options

You must be logged in to vote

You can pass type_encoders / type_decoders on every layer. These allow you to define custom msgspec hooks.

https://docs.litestar.dev/latest/reference/app.html#litestar.app.Litestar.params.type_encoders

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stewit
Comment options

@provinzkraut
Comment options

@stewit
Comment options

Answer selected by stewit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants