You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, if you want to deserialize your input data into object using marshmallow you have to do double-work: create a schema and create a similar to the schema class. Even worse, if you need to change your fields, you have to sync changes in two places.
You describe your model once and you are ready to go. If you want more control over your fields - there's a schema for this (its like fields in Marshmallow, I guess).
More info about pydantic
Cool think that you use native type hints for its description. If you are fan of dataclasses in Python 3.7 - they have that too. Also, they are fast.
The project is still kind of young, but powerful already.
The text was updated successfully, but these errors were encountered:
Problem
At the moment, if you want to deserialize your input data into object using
marshmallow
you have to do double-work: create a schema and create a similar to the schema class. Even worse, if you need to change your fields, you have to sync changes in two places.For all examples, we have the same input:
This is how you create a list of
User
objects withmarshmallow
:How can we avoid this
With pydantic, you can do the following:
You describe your model once and you are ready to go. If you want more control over your fields - there's a schema for this (its like
fields
in Marshmallow, I guess).More info about
pydantic
Cool think that you use native type hints for its description. If you are fan of dataclasses in Python 3.7 - they have that too. Also, they are fast.
The project is still kind of young, but powerful already.
The text was updated successfully, but these errors were encountered: