Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pibi committed Jul 19, 2022
1 parent 8a7ce09 commit d574f04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ const Ajv = require("ajv");
const addFormats = require("ajv-formats");
const addKeywords = require("ajv-keywords");

const BaseValidator = require("moleculer/src/validators/base");
const FallbackValidator = require("moleculer/src/validators/fastest");
const {ValidationError} = require("moleculer/src/errors");
const { Validators, Errors: { ValidationError } } = require("moleculer");

class AjvValidator extends BaseValidator {
constructor (options) {
class AjvValidator extends Validators.Base {
constructor (options = {}) {
super();
this.validator = new Ajv(options);
addKeywords(this.validator);
addFormats(this.validator);
this.fallbackValidator = new FallbackValidator();
this.fallbackValidator = new Validators.Fastest();
}

compile (schema) {
Expand Down
3 changes: 1 addition & 2 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use strict";

const { ServiceBroker } = require("moleculer");
const { ValidationError } = require("moleculer").Errors;
const { ServiceBroker, Errors: { ValidationError }} = require("moleculer");

beforeAll(async () => {});
afterAll(async () => {});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moleculer-json-schema-validator",
"version": "3.0.0",
"version": "3.0.1",
"description": "json-schema validator for moleculer",
"keywords": [
"moleculer",
Expand Down

0 comments on commit d574f04

Please sign in to comment.