Skip to content

Commit

Permalink
Make sure to only encode version_info in json if available
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Jul 31, 2024
1 parent 54f49a7 commit b49d7be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/podio_gen/generator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import re
import json
from copy import deepcopy


def _get_namespace_class(full_type):
Expand Down Expand Up @@ -324,7 +325,11 @@ def __init__(
def _to_json(self):
"""Return the dictionary, so that we can easily hook this into the pythons
JSON ecosystem"""
return self.__dict__
definition = deepcopy(self.__dict__)
# Only dump the version information if it's populated
if definition["version_info"] is None:
del definition["version_info"]
return definition


class DataModelJSONEncoder(json.JSONEncoder):
Expand Down

0 comments on commit b49d7be

Please sign in to comment.