python-jsonschema-objects icon indicating copy to clipboard operation
python-jsonschema-objects copied to clipboard

Fix 0 default values appearing as None

Open nkakouros opened this issue 10 months ago • 0 comments

Consider the following json schema snippet to define a property:

{
    "type" : "number",
    "minimum" : 0,
    "maximum" : 1,
    "default": 0
}

The code that sets the default reads:

"__default__": clsdata.get("default") or clsdata.get("const"),

If the default is 0 as in the example above, then the right branch of the or will be selected and result to None.

nkakouros avatar Apr 06 '24 14:04 nkakouros