When Using the Nullable type option if the value isn't set and is therefore _NULL_TYPE json.dump will throw an error. See code example below.
>>> from dataclasses_jsonschema.type_defs import _NULL_TYPE
>>> my_dict = { "foo" : _NULL_TYPE }
>>> import json
>>> my_str = json.dumps(my_dict)
Traceback (most recent call last):
File "<stdin>", line 1, in <module> File "/usr/lib/python3.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.7/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.7/json/encoder.py", line 257, in iterencode return _iterencode(o, 0)
File "/usr/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type type is not JSON serializable
>>>
When Using the Nullable type option if the value isn't set and is therefore _NULL_TYPE json.dump will throw an error. See code example below.