UNPKG

692 BJavaScriptView Raw
1/*!
2 * Copyright (c) 2019 Digital Bazaar, Inc. All rights reserved.
3 */
4const bedrock = require('bedrock');
5const jsonPatch = require('./jsonPatch');
6
7const schema = {
8 required: ['patch', 'sequence', 'target'],
9 title: 'Sequence-based JSON Patch',
10 type: 'object',
11 properties: {
12 target: {
13 type: 'string',
14 },
15 // FIXME: also support `frame` property later
16 patch: jsonPatch(),
17 sequence: {
18 type: 'integer',
19 minimum: 0,
20 maximum: Number.MAX_SAFE_INTEGER
21 }
22 },
23 additionalProperties: false
24};
25
26module.exports = function(extend) {
27 if(extend) {
28 return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
29 }
30 return schema;
31};