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

     1  [
     2  	{
     3  		"description": "propertyNames validation",
     4  		"schema": {
     5  			"propertyNames": {
     6  				"maxLength": 3
     7  			}
     8  		},
     9  		"skip": {
    10  			"v2": "extract error: cannot compile resulting schema: reference \"strings\" in label expression refers to field against which it would be matched:\n    generated.cue:4:3\n",
    11  			"v3": "extract error: cannot compile resulting schema: reference \"strings\" in label expression refers to field against which it would be matched:\n    generated.cue:4:3\n"
    12  		},
    13  		"tests": [
    14  			{
    15  				"description": "all property names valid",
    16  				"data": {
    17  					"f": {},
    18  					"foo": {}
    19  				},
    20  				"valid": true,
    21  				"skip": {
    22  					"v2": "could not compile schema",
    23  					"v3": "could not compile schema"
    24  				}
    25  			},
    26  			{
    27  				"description": "some property names invalid",
    28  				"data": {
    29  					"foo": {},
    30  					"foobar": {}
    31  				},
    32  				"valid": false,
    33  				"skip": {
    34  					"v2": "could not compile schema",
    35  					"v3": "could not compile schema"
    36  				}
    37  			},
    38  			{
    39  				"description": "object without properties is valid",
    40  				"data": {},
    41  				"valid": true,
    42  				"skip": {
    43  					"v2": "could not compile schema",
    44  					"v3": "could not compile schema"
    45  				}
    46  			},
    47  			{
    48  				"description": "ignores arrays",
    49  				"data": [
    50  					1,
    51  					2,
    52  					3,
    53  					4
    54  				],
    55  				"valid": true,
    56  				"skip": {
    57  					"v2": "could not compile schema",
    58  					"v3": "could not compile schema"
    59  				}
    60  			},
    61  			{
    62  				"description": "ignores strings",
    63  				"data": "foobar",
    64  				"valid": true,
    65  				"skip": {
    66  					"v2": "could not compile schema",
    67  					"v3": "could not compile schema"
    68  				}
    69  			},
    70  			{
    71  				"description": "ignores other non-objects",
    72  				"data": 12,
    73  				"valid": true,
    74  				"skip": {
    75  					"v2": "could not compile schema",
    76  					"v3": "could not compile schema"
    77  				}
    78  			}
    79  		]
    80  	},
    81  	{
    82  		"description": "propertyNames validation with pattern",
    83  		"schema": {
    84  			"propertyNames": {
    85  				"pattern": "^a+$"
    86  			}
    87  		},
    88  		"tests": [
    89  			{
    90  				"description": "matching property names valid",
    91  				"data": {
    92  					"a": {},
    93  					"aa": {},
    94  					"aaa": {}
    95  				},
    96  				"valid": true
    97  			},
    98  			{
    99  				"description": "non-matching property name is invalid",
   100  				"data": {
   101  					"aaA": {}
   102  				},
   103  				"valid": false,
   104  				"skip": {
   105  					"v2": "unexpected success",
   106  					"v3": "unexpected success"
   107  				}
   108  			},
   109  			{
   110  				"description": "object without properties is valid",
   111  				"data": {},
   112  				"valid": true
   113  			}
   114  		]
   115  	},
   116  	{
   117  		"description": "propertyNames with boolean schema true",
   118  		"schema": {
   119  			"propertyNames": true
   120  		},
   121  		"tests": [
   122  			{
   123  				"description": "object with any properties is valid",
   124  				"data": {
   125  					"foo": 1
   126  				},
   127  				"valid": true
   128  			},
   129  			{
   130  				"description": "empty object is valid",
   131  				"data": {},
   132  				"valid": true
   133  			}
   134  		]
   135  	},
   136  	{
   137  		"description": "propertyNames with boolean schema false",
   138  		"schema": {
   139  			"propertyNames": false
   140  		},
   141  		"tests": [
   142  			{
   143  				"description": "object with any properties is invalid",
   144  				"data": {
   145  					"foo": 1
   146  				},
   147  				"valid": false,
   148  				"skip": {
   149  					"v3": "unexpected success"
   150  				}
   151  			},
   152  			{
   153  				"description": "empty object is valid",
   154  				"data": {},
   155  				"valid": true,
   156  				"skip": {
   157  					"v3": "6 errors in empty disjunction:\nconflicting values [...] and {} (mismatched types list and struct):\n    generated.cue:2:33\n    instance.json:1:1\nconflicting values bool and {} (mismatched types bool and struct):\n    generated.cue:2:8\n    instance.json:1:1\nconflicting values null and {} (mismatched types null and struct):\n    generated.cue:2:1\n    instance.json:1:1\nconflicting values number and {} (mismatched types number and struct):\n    generated.cue:2:15\n    instance.json:1:1\nconflicting values string and {} (mismatched types string and struct):\n    generated.cue:2:24\n    instance.json:1:1\nexplicit error (_|_ literal) in source:\n    generated.cue:3:3\n"
   158  				}
   159  			}
   160  		]
   161  	}
   162  ]