jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
335 stars 51 forks source link

add nullable param for fields #79

Closed kazemat closed 7 years ago

kazemat commented 7 years ago

I add nullable param for BaseField.

This view in JSONSchema: {"type": ["string", "null"]}

beregond commented 7 years ago

Hey, thanks for PR and sorry for late feedback - I'll look on this in detail tomorrow!

beregond commented 7 years ago

Hey, @kazemat finally looked at this PR - looks really nice :) still needs to deal with

so either way you can fix those or I'll take care of it... in some time :)

beregond commented 7 years ago

Nice, thanks for it! Still need to think if __init__ shouldn't disallow to pass both required and nullable as True, so it will be more consistent

kazemat commented 7 years ago

I think this is not necessary. Because the field can be mandatory for the model, but have an empty value

beregond commented 7 years ago

Because the field can be mandatory for the model, but have an empty value

Tricky!

Released in 2.2