cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2020-12/maxProperties.json (about)

     1  [
     2  	{
     3  		"description": "maxProperties validation",
     4  		"schema": {
     5  			"$schema": "https://json-schema.org/draft/2020-12/schema",
     6  			"maxProperties": 2
     7  		},
     8  		"tests": [
     9  			{
    10  				"description": "shorter is valid",
    11  				"data": {
    12  					"foo": 1
    13  				},
    14  				"valid": true
    15  			},
    16  			{
    17  				"description": "exact length is valid",
    18  				"data": {
    19  					"foo": 1,
    20  					"bar": 2
    21  				},
    22  				"valid": true
    23  			},
    24  			{
    25  				"description": "too long is invalid",
    26  				"data": {
    27  					"foo": 1,
    28  					"bar": 2,
    29  					"baz": 3
    30  				},
    31  				"valid": false
    32  			},
    33  			{
    34  				"description": "ignores arrays",
    35  				"data": [
    36  					1,
    37  					2,
    38  					3
    39  				],
    40  				"valid": true
    41  			},
    42  			{
    43  				"description": "ignores strings",
    44  				"data": "foobar",
    45  				"valid": true
    46  			},
    47  			{
    48  				"description": "ignores other non-objects",
    49  				"data": 12,
    50  				"valid": true
    51  			}
    52  		]
    53  	},
    54  	{
    55  		"description": "maxProperties validation with a decimal",
    56  		"schema": {
    57  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    58  			"maxProperties": 2.0
    59  		},
    60  		"tests": [
    61  			{
    62  				"description": "shorter is valid",
    63  				"data": {
    64  					"foo": 1
    65  				},
    66  				"valid": true
    67  			},
    68  			{
    69  				"description": "too long is invalid",
    70  				"data": {
    71  					"foo": 1,
    72  					"bar": 2,
    73  					"baz": 3
    74  				},
    75  				"valid": false
    76  			}
    77  		]
    78  	},
    79  	{
    80  		"description": "maxProperties = 0 means the object is empty",
    81  		"schema": {
    82  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    83  			"maxProperties": 0
    84  		},
    85  		"tests": [
    86  			{
    87  				"description": "no properties is valid",
    88  				"data": {},
    89  				"valid": true
    90  			},
    91  			{
    92  				"description": "one property is invalid",
    93  				"data": {
    94  					"foo": 1
    95  				},
    96  				"valid": false
    97  			}
    98  		]
    99  	}
   100  ]