plank icon indicating copy to clipboard operation
plank copied to clipboard

Support default values for non-enum types

Open shamanskyh opened this issue 7 years ago • 1 comments

We have a Plank schema where we have an integer property. We'd like to specify a default value for that property so that when any new models are initialized, they could have a default value set. In our instance, we'd like the integer property to be preset to -1 when the model is initialized.

Something like this would be ideal:

{
    "id": "button.json",
    "title": "button",
    "description" : "Schema definition of Pinterest button",
    "$schema": "http://json-schema.org/schema#",
    "type": "object",
    "properties": {
        "id" : { "type": "string" },
        "element_type" : {
            "type": "integer",
            "default": -1
        },
    },
    "required": ["id"]
}

shamanskyh avatar Sep 12 '18 22:09 shamanskyh

This would be great for Kotlin or Java as well!

NightlyNexus avatar Sep 14 '18 21:09 NightlyNexus