0

I'm using flask-restful, flask-sqlalchemy and flask-marshmallow to build an API service. I define the following -

ma = Marshmallow(app)

However, trying to access the @validates decorator using ma throws an error.

@ma.validates('field1')

What am I doing wrong? Is it better to directly use the marshmallow library and skip using flask-marshmallow altogether?

1 Answers1

0

The problem is that you are trying to reach flask-marshmallow decorators in its API, however there is none.

So you to understand if you need flask-marshmallow package, or only marshmallow is required.

Also to make things work, you need to use validates() decorator as it presented in docs

@validates('field1')
vishes_shell
  • 22,409
  • 6
  • 71
  • 81