marshmallow-jsonschema
marshmallow-jsonschema copied to clipboard
Account for allow_none.
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.
Coverage decreased (-1.0%) to 99.048% when pulling ee17c8db4b3782b16fc31a0ff0fc2c2bff459ba3 on lnhubbell:patch-1 into 6f51771fc809a0762b3d98f4d246b70eb653d802 on fuhrysteve:master.
I have no idea if this is an elegant way to do this, it worked for the project I'm working on right now, I'd love to see a better implementation.
Interesting - ok I think this makes sense. When I glanced at this before I wasn't sure what this was trying to do, but looking into it I found this:
http://stackoverflow.com/questions/16241333/specify-a-value-can-be-a-string-or-null-with-json-schema
I think this functionality belongs in _from_python_type
, though.
Here is where type
is set initially:
https://github.com/lnhubbell/marshmallow-jsonschema/blob/ee17c8db4b3782b16fc31a0ff0fc2c2bff459ba3/marshmallow_jsonschema/base.py#L132-L133
so we probably just need to move those two lines after that, add a test or two, and we're good to go.
Hi @fuhrysteve @lnhubbell , could you please clarify what's the status of this PR? I wouldn't mind implementing any of the corrections needed myself to get this into master.
I haven’t touched this in ages, no idea where it’s at now. Good luck!
On Wed, Jul 10, 2019 at 9:19 AM Stanislav [email protected] wrote:
Hi @fuhrysteve https://github.com/fuhrysteve @lnhubbell https://github.com/lnhubbell , could you please clarify what's the status of this PR? I wouldn't mind reopening implementing any of the corrections needed myself to get this into master.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/fuhrysteve/marshmallow-jsonschema/pull/19?email_source=notifications&email_token=ABXSICIZX5LFIJVZBZACO6LP6YD2RA5CNFSM4CPGJ3A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZT7XEA#issuecomment-510131088, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXSICLRWRCVFQFZGVBXN5LP6YD2RANCNFSM4CPGJ3AQ .
This was fixed in #106 , I suggest it is closed.