marshmallow-oneofschema icon indicating copy to clipboard operation
marshmallow-oneofschema copied to clipboard

None type object in OneOfSchema

Open froggylab opened this issue 4 years ago • 0 comments

Hello,

I use Marshmallow-oneofschema with flask_restx, sqlalchemy and flask_accepts. When I query a nonexistent object with the normal schemas, the result is {}. With OneOfSchema, unfortunately, it's not working because the NoneType value doens't match any schema :

[ null, { "_schema": "Unsupported object type: <class 'NoneType'>" } ]

Do you think it's possible to add something like this :+1:

    if obj_type is NoneType:
        return {}

Thank you, Rom

froggylab avatar Apr 12 '20 14:04 froggylab