Skip to content

Commit

Permalink
Account for allow_none.
Browse files Browse the repository at this point in the history
When allow_none is set to True in the marshmallow schema, we have to add 'null' to the list of possible types. Other wise you get a None is not a Number error.
  • Loading branch information
lnhubbell authored Sep 10, 2016
1 parent 6f51771 commit ee17c8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion marshmallow_jsonschema/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def get_properties(self, obj):
schema = FIELD_VALIDATORS[validator.__class__](
schema, field, validator, obj
)

if field.allow_none:
schema['type'] = [schema['type'], 'null']

properties[field.name] = schema

return properties
Expand Down

0 comments on commit ee17c8d

Please sign in to comment.