source: trip-planner-front/node_modules/ajv-errors/index.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict';
2
3module.exports = function (ajv, options) {
4 if (!ajv._opts.allErrors) throw new Error('ajv-errors: Ajv option allErrors must be true');
5 if (!ajv._opts.jsonPointers) {
6 console.warn('ajv-errors: Ajv option jsonPointers changed to true');
7 ajv._opts.jsonPointers = true;
8 }
9
10 ajv.addKeyword('errorMessage', {
11 inline: require('./lib/dotjs/errorMessage'),
12 statements: true,
13 valid: true,
14 errors: 'full',
15 config: {
16 KEYWORD_PROPERTY_PARAMS: {
17 required: 'missingProperty',
18 dependencies: 'property'
19 },
20 options: options || {}
21 },
22 metaSchema: {
23 'type': ['string', 'object'],
24 properties: {
25 properties: {$ref: '#/definitions/stringMap'},
26 items: {$ref: '#/definitions/stringList'},
27 required: {$ref: '#/definitions/stringOrMap'},
28 dependencies: {$ref: '#/definitions/stringOrMap'}
29 },
30 additionalProperties: {'type': 'string'},
31 definitions: {
32 stringMap: {
33 'type': ['object'],
34 additionalProperties: {'type': 'string'}
35 },
36 stringOrMap: {
37 'type': ['string', 'object'],
38 additionalProperties: {'type': 'string'}
39 },
40 stringList: {
41 'type': ['array'],
42 items: {'type': 'string'}
43 }
44 }
45 }
46 });
47 return ajv;
48};
Note: See TracBrowser for help on using the repository browser.