title: Generating marshmallow schema automatically with JSON serializable enums
body: <p>Long gone are the days of creating marshmallow schemas identical to my models. I found <a href="https://stackoverflow.com/a/42892443/4097322">this excellent answer</a> that explained how I could auto generate schemas from my SQA models using a simple decorator, so I implemented it and replaced the deprecated <code>ModelSchema</code> for the newer <code>SQLAlchemyAutoSchema</code>:</p>
  <pre><code>def add_schema(cls):
      class Schema(SQLAlchemyAutoSchema):
          class Meta:
              model = cls
      cls.Schema = Schema
  return cls
  </code></pre>
  <p>This worked great... until I bumped into a model with a bloody <code>Enum</code>.</p>
  <p>The error: <code>Object of type MyEnum is not JSON serializable</code></p>
  <p>I searched online and I found <a href="https://stackoverflow.com/a/45026116">this useful answer</a>.</p>
  <p>But I'd like to implement it as part of the decorator so that it is generated automatically as well. In other words, I'd like to automatically overwrite all Enums in my model with <code>EnumField(TheEnum, by_value=True)</code> when generating the schema using the <code>add_schema</code> decorator; that way I won't have to overwrite all the fields manually.</p>
  <p>What would be the best way to do this?</p>