Skip to content

Support for coercing data types #5824

Answered by leandrodamascena
alexiskat asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alexiskat! Thanks for opening this discussion.

We already have the validation utility that can validate input against a JSON schema, but it doesn't support data type coercion before validating it. In this utility we use fastjsonschema, but it also does not support coercion operations before validating the type. Still in this JSON schema space, I was playing around with Cerberus a few months ago and it looks like it supports data coercion before validating, so you can bring it in as a dependency (~300kb) and use it.

But, if you want a more robust library to do that, I would suggest to take a look into Pydantic and see if it make sense for your use case. Pydantic supports Data validatio…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alexiskat
Comment options

You must be logged in to vote
0 replies
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