|
|
@ -1,6 +1,6 @@ |
|
|
|
import { NextFunction, Request, Response } from 'express'; |
|
|
|
import { NextFunction, Request, Response } from 'express'; |
|
|
|
import Ajv, { ErrorObject } from 'ajv'; |
|
|
|
import Ajv, { ErrorObject } from 'ajv'; |
|
|
|
import addFormats from "ajv-formats"; |
|
|
|
import addFormats from 'ajv-formats'; |
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
import swagger from '../../../../schema/swagger.json'; |
|
|
|
import swagger from '../../../../schema/swagger.json'; |
|
|
|
|
|
|
|
|
|
|
@ -12,7 +12,7 @@ export function parseHrtimeToSeconds(hrtime) { |
|
|
|
const ajv = new Ajv({ strictSchema: false, strict: false }); // Initialize AJV
|
|
|
|
const ajv = new Ajv({ strictSchema: false, strict: false }); // Initialize AJV
|
|
|
|
|
|
|
|
|
|
|
|
ajv.addSchema(swagger, 'swagger.json'); |
|
|
|
ajv.addSchema(swagger, 'swagger.json'); |
|
|
|
addFormats(ajv) |
|
|
|
addFormats(ajv); |
|
|
|
|
|
|
|
|
|
|
|
// A middleware generator to validate the request body
|
|
|
|
// A middleware generator to validate the request body
|
|
|
|
export const getAjvValidatorMw = (schema) => { |
|
|
|
export const getAjvValidatorMw = (schema) => { |
|
|
|