1010
1111const _ = require ( 'lodash' ) ;
1212const logger = require ( '../logger' ) . access ;
13- const validator = require ( 'ajv' ) ;
13+ const Ajv = require ( 'ajv/dist/2020 ' ) ;
1414const error = require ( './error' ) ;
1515const userModel = require ( '../models/user' ) ;
1616const proxyHostModel = require ( '../models/proxy_host' ) ;
@@ -174,7 +174,6 @@ module.exports = function (token_string) {
174174
175175 let schema = {
176176 $id : 'objects' ,
177- $schema : 'http://json-schema.org/draft-07/schema#' ,
178177 description : 'Actor Properties' ,
179178 type : 'object' ,
180179 additionalProperties : false ,
@@ -251,7 +250,7 @@ module.exports = function (token_string) {
251250 // Initialised, token decoded ok
252251 return this . getObjectSchema ( permission )
253252 . then ( ( objectSchema ) => {
254- let data_schema = {
253+ const data_schema = {
255254 [ permission ] : {
256255 data : data ,
257256 scope : Token . get ( 'scope' ) ,
@@ -267,7 +266,6 @@ module.exports = function (token_string) {
267266 } ;
268267
269268 let permissionSchema = {
270- $schema : 'http://json-schema.org/draft-07/schema#' ,
271269 $async : true ,
272270 $id : 'permissions' ,
273271 additionalProperties : false ,
@@ -276,14 +274,9 @@ module.exports = function (token_string) {
276274
277275 permissionSchema . properties [ permission ] = require ( './access/' + permission . replace ( / : / gim, '-' ) + '.json' ) ;
278276
279- // logger.info('objectSchema', JSON.stringify(objectSchema, null, 2));
280- // logger.info('permissionSchema', JSON.stringify(permissionSchema, null, 2));
281- // logger.info('data_schema', JSON.stringify(data_schema, null, 2));
282-
283- let ajv = validator ( {
277+ const ajv = new Ajv ( {
284278 verbose : true ,
285279 allErrors : true ,
286- format : 'full' ,
287280 missingRefs : 'fail' ,
288281 breakOnError : true ,
289282 coerceTypes : true ,
0 commit comments