Closed yeralin closed 5 years ago
Hi,
I have a rather unusual problem. I have a wrapper on top of marshmallow.fields.* classes. Something similar to:
marshmallow.fields.*
from marshmallow.fields import String class CustomString(String): ...
When I try to generate a JSON schema that contains one of those wrapped fields like CustomString, the generator raises UnsupportedValueError. After looking at the code, I noticed this line: https://github.com/fuhrysteve/marshmallow-jsonschema/blob/master/marshmallow_jsonschema/base.py#L158
CustomString
UnsupportedValueError
Where my field.__class__ resolves to CustomString while mapping contains marshmallow.fields.String.
field.__class__
mapping
marshmallow.fields.String
That was a bummer. I wrote a quick PR for this issue that instead checks whether field's class is a subclass of one of the marshmallow.fields.*.
Feel free to share your thoughts about it!
Thank you! ❤️
Hi,
I have a rather unusual problem. I have a wrapper on top of
marshmallow.fields.*
classes. Something similar to:When I try to generate a JSON schema that contains one of those wrapped fields like
CustomString
, the generator raisesUnsupportedValueError
. After looking at the code, I noticed this line: https://github.com/fuhrysteve/marshmallow-jsonschema/blob/master/marshmallow_jsonschema/base.py#L158Where my
field.__class__
resolves toCustomString
whilemapping
containsmarshmallow.fields.String
.That was a bummer. I wrote a quick PR for this issue that instead checks whether field's class is a subclass of one of the
marshmallow.fields.*
.Feel free to share your thoughts about it!
Thank you! ❤️