aromanovich / jsl

A Python DSL for describing JSON schemas
http://jsl.readthedocs.org/
Other
218 stars 21 forks source link

Allow specification of fields that have a default of null. #9

Closed nhoad closed 9 years ago

nhoad commented 9 years ago

This allows you to specify fields that have a default value of null.

I wanted to specify a field that can be null or some other value, with a default of null. Using the default of None as a sentinel for "no default" prevented me from doing this.

I'd normally have preferred to change the default parameter to a SENTINEL_NONE object that is merely an object() to allow None to represent null properly, but I can't do that without breaking API compatibility with the get_default() method.

aromanovich commented 9 years ago

Thanks! I've released a new version (0.1.2) containing this feature on PyPI.