s-knibbs / dataclasses-jsonschema

JSON schema generation from dataclasses
MIT License
166 stars 38 forks source link

Question on use with inherited classes #138

Open richard-moss opened 3 years ago

richard-moss commented 3 years ago

I checked out the test entry for inherited classes and noted that the mixin is only included with the parent class:

def test_inherited_schema():
    @dataclass
    class Pet(JsonSchemaMixin):
        """A generic pet"""
        name: str

    @dataclass
    class Cat(Pet):
        """A cat"""
        hunting_skill: str

I tested including the mixin in both the parent and child classes (so also including it in Cat above), and it still seems to work correctly - but I'm wondering is that a problem that you should avoid doing, or is that OK?