lidatong / dataclasses-json

Easily serialize Data Classes to and from JSON
MIT License
1.36k stars 153 forks source link

Fix: default_factory returned without being called when filling default value in schema #406

Closed jamesbw closed 1 year ago

jamesbw commented 1 year ago

The default_factory is a factory for generating the default value. For example, to get a default of [], the default_factory will be list.

Without calling the factory, the schema will be filled with, in this case, "<class: 'list'>". Whereas if you call the factory, the default will correctly be set to [].