Sha256: 3d8ef0e85f1786e34827d8c019f5f114988451bbdf447e4e388faa1cb7ccd3cf

Contents?: true

Size: 1.31 KB

Versions: 27

Compression:

Stored size: 1.31 KB

Contents

'use strict';

module.exports = function (ajv, options) {
  if (!ajv._opts.allErrors) throw new Error('ajv-errors: Ajv option allErrors must be true');
  if (!ajv._opts.jsonPointers) {
    console.warn('ajv-errors: Ajv option jsonPointers changed to true');
    ajv._opts.jsonPointers = true;
  }

  ajv.addKeyword('errorMessage', {
    inline: require('./lib/dotjs/errorMessage'),
    statements: true,
    valid: true,
    errors: 'full',
    config: {
      KEYWORD_PROPERTY_PARAMS: {
        required: 'missingProperty',
        dependencies: 'property'
      },
      options: options || {}
    },
    metaSchema: {
      'type': ['string', 'object'],
      properties: {
        properties: {$ref: '#/definitions/stringMap'},
        items: {$ref: '#/definitions/stringList'},
        required: {$ref: '#/definitions/stringOrMap'},
        dependencies: {$ref: '#/definitions/stringOrMap'}
      },
      additionalProperties: {'type': 'string'},
      definitions: {
        stringMap: {
          'type': ['object'],
          additionalProperties: {'type': 'string'}
        },
        stringOrMap: {
          'type': ['string', 'object'],
          additionalProperties: {'type': 'string'}
        },
        stringList: {
          'type': ['array'],
          items: {'type': 'string'}
        }
      }
    }
  });
  return ajv;
};

Version data entries

27 entries across 26 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/ajv-errors/index.js
disco_app-0.18.0 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.18.2 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.16.1 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.15.2 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.18.4 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.18.1 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.14.0 test/dummy/node_modules/ajv-errors/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/ajv-errors/index.js
tang-0.2.1 spec/tang_app/node_modules/ajv-errors/index.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/ajv-errors/index.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/ajv-errors/index.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/ajv-errors/index.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/ajv-errors/index.js
tang-0.2.0 spec/tang_app/node_modules/ajv-errors/index.js
tang-0.1.0 spec/tang_app/node_modules/ajv-errors/index.js
tang-0.0.9 spec/tang_app/node_modules/ajv-errors/index.js
enju_library-0.3.8 spec/dummy/node_modules/ajv-errors/index.js
jester-data-8.0.0 node_modules/ajv-errors/index.js