-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjson-patch.schema.json
116 lines (116 loc) · 4.26 KB
/
json-patch.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/nineteendo/jsonyx/main/json-patch.schema.json",
"definitions": {
"operation": {
"description": "A JSON patch operation.",
"type": "object",
"properties": {
"op": {
"description": "The operation to perform.",
"type": "string",
"enum": ["append", "assert", "clear", "copy", "del", "extend", "insert", "move", "reverse", "set", "sort", "update"]
},
"path": {"description": "A JSON path.", "type": "string", "default": "$"}
},
"required": ["op"],
"allOf": [
{
"if": {
"properties": {
"op": {
"enum": ["append", "extend", "insert", "set", "update"]
}
},
"required": ["op"]
},
"then": {
"properties": {
"value": {"description": "The value to use."}
},
"required": ["value"]
}
},
{
"if": {
"properties": {
"op": {"const": "assert"}
},
"required": ["op"]
},
"then": {
"properties": {
"expr": {"description": "A JSON expression.", "type": "string", "default": "@"}
},
"required": ["expr"]
}
},
{
"if": {
"properties": {
"op": {
"enum": ["copy", "move"]
}
},
"required": ["op"]
},
"then": {
"properties": {
"mode": {
"description": "The paste mode.",
"type": "string",
"enum": ["append", "extend", "insert", "set", "update"]
},
"from": {"description": "The source JSON path.", "type": "string", "default": "@"},
"to": {"description": "The destination JSON path.", "type": "string", "default": "@"}
},
"required": ["mode", "from"],
"if": {
"properties": {
"mode": {"const": "insert"}
},
"required": ["mode"]
},
"then": {
"required": ["to"]
}
}
},
{
"if": {
"properties": {
"op": {
"enum": ["del", "insert"]
}
},
"required": ["op"]
},
"then": {
"required": ["path"]
}
},
{
"if": {
"properties": {
"op": {"const": "sort"}
},
"required": ["op"]
},
"then": {
"properties": {
"reverse": {"description": "Sort in descending order.", "type": "boolean", "default": false}
}
}
}
],
"unevaluatedProperties": false
}
},
"anyOf": [
{"$ref": "#/definitions/operation"},
{
"type": "array",
"items": {"$ref": "#/definitions/operation"}
}
]
}