yunstanford/sanic-transmute

raise on model mismatch

Closed this issue · 2 comments

Hello

When the model describe does not match the actual returned data, the value are actually removed from the returned json, silently. Can we have a mode where it would raise an exception instead ?

Ex:

class MyModel(Model):
    a_name = IntType()

actual returned data by the API:

{
  another_nane: 0
}

Actual returned value:

{}

Expected result:

Error 500: model expects..., actual:...

Yeah, because underlying schematics validation is not in strict mode. Also, due to performance reason, we'd like to migrate to attrs, instead.

Indeed, attrs (or dataclass) is really cool.