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

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