Skip to the content.

Root level property

JSON schema example demonstrating a schema with properties that have default values

$iddefault-values.yml
$schemahttp://json-schema.org/draft-07/schema#

Properties

NameType
defaultStringString
defaultObjectObject

Example

{
    "defaultString": "Hello",
    "defaultObject": {
        "foo": "bar"
    }
}

defaultString

Title Default String
Description A string property with a default
TypeString
Required No
Default Hello

defaultObject

Title Default Object
Description An object property value with a default
TypeObject
Required No
Default [object Object]

Properties

NameType
fooString

defaultObject.foo

Title Foo
TypeString
Required No

Schema

{
    "$id": "default-values.yml",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Root level property",
    "description": "JSON schema example demonstrating a schema with properties that have default values",
    "type": "object",
    "examples": [
        {
            "defaultString": "Hello",
            "defaultObject": {
                "foo": "bar"
            }
        }
    ],
    "properties": {
        "defaultString": {
            "title": "Default String",
            "description": "A string property with a default",
            "type": "string",
            "default": "Hello"
        },
        "defaultObject": {
            "title": "Default Object",
            "description": "An object property value with a default",
            "type": "object",
            "properties": {
                "foo": {
                    "type": "string",
                    "title": "Foo"
                }
            },
            "default": {
                "foo": "bar"
            }
        }
    },
    "additionalProperties": false
}