cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft7/default.json (about)

     1  [
     2  	{
     3  		"description": "invalid type for default",
     4  		"schema": {
     5  			"properties": {
     6  				"foo": {
     7  					"type": "integer",
     8  					"default": []
     9  				}
    10  			}
    11  		},
    12  		"tests": [
    13  			{
    14  				"description": "valid when property is specified",
    15  				"data": {
    16  					"foo": 13
    17  				},
    18  				"valid": true
    19  			},
    20  			{
    21  				"description": "still valid when the invalid default is used",
    22  				"data": {},
    23  				"valid": true
    24  			}
    25  		]
    26  	},
    27  	{
    28  		"description": "invalid string value for default",
    29  		"schema": {
    30  			"properties": {
    31  				"bar": {
    32  					"type": "string",
    33  					"minLength": 4,
    34  					"default": "bad"
    35  				}
    36  			}
    37  		},
    38  		"tests": [
    39  			{
    40  				"description": "valid when property is specified",
    41  				"data": {
    42  					"bar": "good"
    43  				},
    44  				"valid": true
    45  			},
    46  			{
    47  				"description": "still valid when the invalid default is used",
    48  				"data": {},
    49  				"valid": true
    50  			}
    51  		]
    52  	},
    53  	{
    54  		"description": "the default keyword does not do anything if the property is missing",
    55  		"schema": {
    56  			"type": "object",
    57  			"properties": {
    58  				"alpha": {
    59  					"type": "number",
    60  					"maximum": 3,
    61  					"default": 5
    62  				}
    63  			}
    64  		},
    65  		"tests": [
    66  			{
    67  				"description": "an explicit property value is checked against maximum (passing)",
    68  				"data": {
    69  					"alpha": 1
    70  				},
    71  				"valid": true
    72  			},
    73  			{
    74  				"description": "an explicit property value is checked against maximum (failing)",
    75  				"data": {
    76  					"alpha": 5
    77  				},
    78  				"valid": false
    79  			},
    80  			{
    81  				"description": "missing properties are not filled in with the default",
    82  				"data": {},
    83  				"valid": true
    84  			}
    85  		]
    86  	}
    87  ]