1 |
|
2 |
|
3 |
|
4 | const bedrock = require('bedrock');
|
5 |
|
6 | const schema = {
|
7 | title: 'JSON Patch',
|
8 | type: 'array',
|
9 | minItems: 1,
|
10 | items: {
|
11 | type: 'object',
|
12 | required: ['op', 'path'],
|
13 |
|
14 | properties: {
|
15 | op: {
|
16 | type: 'string',
|
17 | enum: ['add', 'copy', 'move', 'remove', 'replace', 'test']
|
18 | },
|
19 | from: {
|
20 | type: 'string',
|
21 | },
|
22 | path: {
|
23 | type: 'string',
|
24 | },
|
25 | value: {
|
26 |
|
27 | }
|
28 | },
|
29 | additionalProperties: false
|
30 | }
|
31 | };
|
32 |
|
33 | module.exports = function(extend) {
|
34 | if(extend) {
|
35 | return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
|
36 | }
|
37 | return schema;
|
38 | };
|