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

     1  [
     2  	{
     3  		"description": "additionalProperties being false does not allow other properties",
     4  		"schema": {
     5  			"properties": {
     6  				"foo": {},
     7  				"bar": {}
     8  			},
     9  			"patternProperties": {
    10  				"^v": {}
    11  			},
    12  			"additionalProperties": false
    13  		},
    14  		"tests": [
    15  			{
    16  				"description": "no additional properties is valid",
    17  				"data": {
    18  					"foo": 1
    19  				},
    20  				"valid": true
    21  			},
    22  			{
    23  				"description": "an additional property is invalid",
    24  				"data": {
    25  					"foo": 1,
    26  					"bar": 2,
    27  					"quux": "boom"
    28  				},
    29  				"valid": false
    30  			},
    31  			{
    32  				"description": "ignores arrays",
    33  				"data": [
    34  					1,
    35  					2,
    36  					3
    37  				],
    38  				"valid": true
    39  			},
    40  			{
    41  				"description": "ignores strings",
    42  				"data": "foobarbaz",
    43  				"valid": true
    44  			},
    45  			{
    46  				"description": "ignores other non-objects",
    47  				"data": 12,
    48  				"valid": true
    49  			},
    50  			{
    51  				"description": "patternProperties are not additional properties",
    52  				"data": {
    53  					"foo": 1,
    54  					"vroom": 2
    55  				},
    56  				"valid": true
    57  			}
    58  		]
    59  	},
    60  	{
    61  		"description": "non-ASCII pattern with additionalProperties",
    62  		"schema": {
    63  			"patternProperties": {
    64  				"^á": {}
    65  			},
    66  			"additionalProperties": false
    67  		},
    68  		"tests": [
    69  			{
    70  				"description": "matching the pattern is valid",
    71  				"data": {
    72  					"ármányos": 2
    73  				},
    74  				"valid": true
    75  			},
    76  			{
    77  				"description": "not matching the pattern is invalid",
    78  				"data": {
    79  					"élmény": 2
    80  				},
    81  				"valid": false
    82  			}
    83  		]
    84  	},
    85  	{
    86  		"description": "additionalProperties with schema",
    87  		"schema": {
    88  			"properties": {
    89  				"foo": {},
    90  				"bar": {}
    91  			},
    92  			"additionalProperties": {
    93  				"type": "boolean"
    94  			}
    95  		},
    96  		"tests": [
    97  			{
    98  				"description": "no additional properties is valid",
    99  				"data": {
   100  					"foo": 1
   101  				},
   102  				"valid": true
   103  			},
   104  			{
   105  				"description": "an additional valid property is valid",
   106  				"data": {
   107  					"foo": 1,
   108  					"bar": 2,
   109  					"quux": true
   110  				},
   111  				"valid": true
   112  			},
   113  			{
   114  				"description": "an additional invalid property is invalid",
   115  				"data": {
   116  					"foo": 1,
   117  					"bar": 2,
   118  					"quux": 12
   119  				},
   120  				"valid": false
   121  			}
   122  		]
   123  	},
   124  	{
   125  		"description": "additionalProperties can exist by itself",
   126  		"schema": {
   127  			"additionalProperties": {
   128  				"type": "boolean"
   129  			}
   130  		},
   131  		"tests": [
   132  			{
   133  				"description": "an additional valid property is valid",
   134  				"data": {
   135  					"foo": true
   136  				},
   137  				"valid": true
   138  			},
   139  			{
   140  				"description": "an additional invalid property is invalid",
   141  				"data": {
   142  					"foo": 1
   143  				},
   144  				"valid": false
   145  			}
   146  		]
   147  	},
   148  	{
   149  		"description": "additionalProperties are allowed by default",
   150  		"schema": {
   151  			"properties": {
   152  				"foo": {},
   153  				"bar": {}
   154  			}
   155  		},
   156  		"tests": [
   157  			{
   158  				"description": "additional properties are allowed",
   159  				"data": {
   160  					"foo": 1,
   161  					"bar": 2,
   162  					"quux": true
   163  				},
   164  				"valid": true
   165  			}
   166  		]
   167  	},
   168  	{
   169  		"description": "additionalProperties does not look in applicators",
   170  		"schema": {
   171  			"allOf": [
   172  				{
   173  					"properties": {
   174  						"foo": {}
   175  					}
   176  				}
   177  			],
   178  			"additionalProperties": {
   179  				"type": "boolean"
   180  			}
   181  		},
   182  		"tests": [
   183  			{
   184  				"description": "properties defined in allOf are not examined",
   185  				"data": {
   186  					"foo": 1,
   187  					"bar": true
   188  				},
   189  				"valid": false
   190  			}
   191  		]
   192  	},
   193  	{
   194  		"description": "additionalProperties with null valued instance properties",
   195  		"schema": {
   196  			"additionalProperties": {
   197  				"type": "null"
   198  			}
   199  		},
   200  		"tests": [
   201  			{
   202  				"description": "allows null values",
   203  				"data": {
   204  					"foo": null
   205  				},
   206  				"valid": true
   207  			}
   208  		]
   209  	}
   210  ]