DictSerializable
¶
Convert to/from dictionaries to the appropriate class/instance.
Currently, it will try to (de)serialize the following types:
- dict
- dataclasses
- attrs (if installed)
- pydantic (if installed)
- msgspec (if installed)
In the future, you will be able to plug in your own (de)serializers instead.
Source code in quickapi/serializers/base.py
Python | |
---|---|
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
Dataclasses¶
DataclassDeserializer
¶
Convert from dataclass model to dict.
Source code in quickapi/serializers/dataclass.py
Python | |
---|---|
33 34 35 36 37 38 39 40 41 42 43 44 |
|
DataclassSerializer
¶
Convert from dict to attrs model.
Source code in quickapi/serializers/dataclass.py
Python | |
---|---|
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Attrs¶
AttrsDeserializer
¶
Convert from attrs model to dict.
Source code in quickapi/serializers/attrs.py
Python | |
---|---|
33 34 35 36 37 38 39 40 41 42 43 44 |
|
AttrsSerializer
¶
Convert from dict to attrs model.
Source code in quickapi/serializers/attrs.py
Python | |
---|---|
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Pydantic¶
PydanticDeserializer
¶
Convert from pydantic model to dict.
Source code in quickapi/serializers/pydantic.py
Python | |
---|---|
32 33 34 35 36 37 38 39 40 41 |
|
PydanticSerializer
¶
Convert from dict to pydantic model.
Source code in quickapi/serializers/pydantic.py
Python | |
---|---|
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Msgspec¶
MsgspecDeserializer
¶
Convert from msgspec.Struct to dict.
Source code in quickapi/serializers/msgspec.py
Python | |
---|---|
33 34 35 36 37 38 39 40 41 42 |
|
MsgspecSerializer
¶
Convert from dict to msgspec.Struct.
Source code in quickapi/serializers/msgspec.py
Python | |
---|---|
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|