Skip to content

Commit f064ec6

Browse files
committed
Adds json dump overload
1 parent 3b49dc8 commit f064ec6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/mdio/schemas/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ def model_dump_json(self, *args, **kwargs) -> dict: # noqa: ANN201 ANN001 ANN00
6666
if "exclude_none" not in kwargs:
6767
kwargs["exclude_none"] = True
6868
return super().model_dump_json(*args, **kwargs)
69+
70+
def json(self, *args, **kwargs) -> dict: # noqa: ANN201 ANN001 ANN002 ANN003
71+
"""Dump JSON using camelCase aliases and excluding None values by default."""
72+
if "by_alias" not in kwargs:
73+
kwargs["by_alias"] = True
74+
return self.model_dump_json(*args, **kwargs)

0 commit comments

Comments
 (0)