mayureshagashe2105
released this
28 Jul 04:45
·
15 commits
to main
since this release
Release 0.2.0
Highlights
- This release focuses on migrating the API to be compatible with the new
Pydantic V2 engine
, to get 20-30% improved performance.
Migration
- Pydantic V2 deprecated the use of
pydantic.json.ENCODER_BY_TYPES
hence the API now uses custom json encoders provided asfastapi.encoders.jsonable_encoder
. Config
class now contains all the .env variables as per Pydantic V2 requirements.- Now Pydantic Settings is an additional optional package (included in
fastapi[all]
). To use settings you should now import frompydantic_settings import BaseSettings
instead of importing frompydantic
directly.
Major Features and Improvements
@json_encoder
wrapper- As hinted in the migration section, Pydantic V2 deprecated the use of
pydantic.json.ENCODER_BY_TYPES
hence to serializebson.ObjectID
tostring
datatype, desired methods can be wrapped by using this decorator with desired mappings.
- As hinted in the migration section, Pydantic V2 deprecated the use of