jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
334 stars 51 forks source link

JSON schema raises error for validators in derived fields #116

Closed DanielSchiavini closed 5 years ago

DanielSchiavini commented 6 years ago

If we use any validator for list or embedded fields, the following error is raised in the method modify_schema:

{TypeError}'ListBuilder' object is not subscriptable

In order to reproduce this:

    class People(models.Base):
        names = fields.ListField(str, validators=validators.Length(2, 4))
        surname = fields.StringField()

    schema = People.to_json_schema()
DanielSchiavini commented 6 years ago

This is fixed in https://github.com/beregond/jsonmodels/pull/120