fuhrysteve/marshmallow-jsonschema

AttributeError: 'dict' object has no attribute 'data' on on List of Nested fields

bnopne opened this issue · 4 comments

I get 'dict' object has no attribute 'data' when i try to generate JSON schema for a model which contains List of Nested fields, here is an example of broken code:

        class User(Schema):
            f1 = fields.Integer()

        class UserList(Schema):
            f2 = fields.List(fields.Nested(User))


        JSONSchema().dump(UserList())

Python 3.6.4
marshmallow==3.0.0b11
marshmallow-jsonschema==0.5.0

Thanks for the report!

Please see #61

this library is not yet compatible with marshmallow >= 3, but once we get a couple minor things sorted out on #61 we'll be good to go.

If you want to start playing around with it on v3, installing from @edgeware's fork should work in the meantime:

pip install -e 'git+https://github.com/edgeware/marshmallow-jsonschema.git@21633cfdbb13eb572727e14ca7b862613f0985d3#egg=marshmallow-jsonschema-dev'

Thanks for clarification and help!

Switching marshmallow to 2.x.x helped me to solve the problem.

@bnopne a proper fix for the issue was merged yesterday so you can use Marshmallow 3.x now if you want to.

@alkanen Thanks a lot! May the Force be with you!