Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernelci.api.model_base: update
model_serializer
Add a hack to handle `exclude` fields while dumping model fields to dictionary. The hack should be removed after a pydantic bug is fixed: pydantic/pydantic#6575 Also, use `SerializationInfo` to get mode of serialization and convert `ObjectId` fields to string only if `json` response is required with `mode=json` in `model_dump` function. That is due to other operations such as inserting or updating objects in DB doesn't need the conversion as data types should be `ObjectId` in the DB. Signed-off-by: Jeny Sadadia <[email protected]>
- Loading branch information