cc @lovasoa
Can class_schema() and .Schema be used interchangeably on a Marshmallow Dataclass?
The documentation, such as in https://pypi.org/project/marshmallow-dataclass/, suggests to use the class_schema() function to generate a marshmallow Schema class from a python builtin dataclass. The doc doesn't say anything about the use of class_schema() on a Marshmallow Dataclass.
Is there any reason not to use class_schema() on a marshmallow dataclass?
The reason I ask is that .Schema confuses type checkers, and the documentation-suggested addition of Schema: ClassVar[Type[Schema]] = Schema in every marshmallow dataclass to counter this confusion just seems like unnecessary boilerplate, if class_schema() provides the same capability (and it already has the proper type annotations)
cc @lovasoa
Can
class_schema()and .Schema be used interchangeably on a Marshmallow Dataclass?The documentation, such as in https://pypi.org/project/marshmallow-dataclass/, suggests to use the
class_schema()function to generate a marshmallow Schema class from a python builtin dataclass. The doc doesn't say anything about the use ofclass_schema()on a Marshmallow Dataclass.Is there any reason not to use
class_schema()on a marshmallow dataclass?The reason I ask is that .Schema confuses type checkers, and the documentation-suggested addition of
Schema: ClassVar[Type[Schema]] = Schemain every marshmallow dataclass to counter this confusion just seems like unnecessary boilerplate, ifclass_schema()provides the same capability (and it already has the proper type annotations)