fix ocr
This commit is contained in:
15
backend/app/schemas/base.py
Normal file
15
backend/app/schemas/base.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""Base schema with camelCase JSON serialization."""
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
def to_camel(s: str) -> str:
|
||||
parts = s.split("_")
|
||||
return parts[0] + "".join(p.capitalize() for p in parts[1:])
|
||||
|
||||
|
||||
class CamelModel(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
from_attributes=True,
|
||||
alias_generator=to_camel,
|
||||
populate_by_name=True,
|
||||
)
|
||||
Reference in New Issue
Block a user