Skip to content

Commit 059f8eb

Browse files
committed
feat(MongoModel) : set input and output data to camel case to respect API naming convention
1 parent 787a03e commit 059f8eb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

fastapi_crudrouter_mongodb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"CRUDEmbed",
1919
]
2020

21-
__version__ = "0.1.1"
21+
__version__ = "0.1.2"
2222
__author__ = "Pierre DUVEAU"
2323
__credits__ = ["Pierre DUVEAU", "Adam Watkins"]

fastapi_crudrouter_mongodb/core/models/mongo_model.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from bson import ObjectId
2-
from pydantic import BaseModel
2+
from pydantic import BaseModel, ConfigDict
3+
from pydantic.alias_generators import to_camel
34

45
from fastapi_crudrouter_mongodb.core.utils.deprecated_util import deprecated
56

67

78
class MongoModel(BaseModel):
8-
class Config:
9-
populate_by_name = True
10-
json_encoders = {ObjectId: str}
9+
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True, json_encoders={ObjectId: str})
10+
1111

1212
@classmethod
1313
def from_mongo(cls, data: dict):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="fastapi-crudrouter-mongodb",
9-
version="0.1.1",
9+
version="0.1.2",
1010
author="Pierre DUVEAU",
1111
author_email="[email protected]",
1212
description="A dynamic FastAPI router that automatically creates CRUD routes for your mongodb models",

0 commit comments

Comments
 (0)