Skip to content

Commit

Permalink
Update field_serializer decorator arguments to not serialize if rate_…
Browse files Browse the repository at this point in the history
…law is None for templates
  • Loading branch information
nanglo123 committed Sep 18, 2024
1 parent 5c326ab commit 2a9fb70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mira/metamodel/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ def from_json(cls, data, rate_symbols=None) -> "Template":
if k not in {'rate_law', 'type'}},
rate_law=rate)

@field_serializer('rate_law')
@field_serializer('rate_law', when_used="unless-none")
def serialize_expression(self, rate_law):
return str(rate_law) if rate_law is not None else None
return str(rate_law)

def is_equal_to(self, other: "Template", with_context: bool = False,
config: Config = None) -> bool:
Expand Down

0 comments on commit 2a9fb70

Please sign in to comment.