xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/draft2020-12/issue798.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2  {
3    "description": "issue798",
4    "schema": {
5      "$schema": "https://json-schema.org/draft/2020-12/schema",
6      "properties": {
7        "a": { "type": "string" },
8        "b": { "type": "string", "readOnly": true },
9        "c": { "type": "string", "writeOnly": true },
10        "d": { "type": "string", "readOnly": true, "writeOnly": true }
11      }
12    },
13    "tests": [
14      {
15        "description": "default behavior",
16        "data": { "a": "a string" },
17        "valid": true,
18        "config": { "readOnly": true, "writeOnly": true }
19      },
20      {
21        "description": "readonly behavior",
22        "data": { "a": "a string", "b": "a string" },
23        "valid": false,
24        "config": { "readOnly": true, "writeOnly": true },
25        "validationMessages": [ "$.b: is a readonly field, it cannot be changed" ]
26      },
27      {
28        "description": "write-only behavior",
29        "data": { "a": "a string", "c": "a string" },
30        "valid": false,
31        "config": { "readOnly": true, "writeOnly": true },
32        "validationMessages": [ "$.c: is a write-only field, it cannot appear in the data" ]
33      },
34      {
35        "description": "both behavior",
36        "data": { "a": "a string", "d": "a string" },
37        "valid": false,
38        "config": { "readOnly": true, "writeOnly": true },
39        "validationMessages": [
40           "$.d: is a readonly field, it cannot be changed",
41           "$.d: is a write-only field, it cannot appear in the data"
42         ]
43      }
44    ]
45  }
46]
47