Skip to content

Commit c2ddf37

Browse files
committed
update: add snake case
1 parent f19b253 commit c2ddf37

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/py/mat3ra/code/entity.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import jsonschema
44
from mat3ra.utils import object as object_utils
5-
from pydantic import BaseModel
5+
from pydantic import BaseModel, ConfigDict
6+
from pydantic.alias_generators import to_snake
67
from typing_extensions import Self
78

89
from . import BaseUnderscoreJsonPropsHandler
@@ -86,6 +87,17 @@ def clone(self: T, extra_context: Optional[Dict[str, Any]] = None, deep=True) ->
8687
return self.model_copy(update=extra_context or {}, deep=deep)
8788

8889

90+
S = TypeVar("S", bound="InMemoryEntitySnakeCase")
91+
92+
93+
class InMemoryEntitySnakeCase(InMemoryEntityPydantic):
94+
model_config = ConfigDict(
95+
arbitrary_types_allowed=True,
96+
alias_generator=to_snake,
97+
populate_by_name=True,
98+
)
99+
100+
89101
# TODO: remove in the next PR
90102
class InMemoryEntity(BaseUnderscoreJsonPropsHandler):
91103
jsonSchema: Optional[Dict] = None

0 commit comments

Comments
 (0)