Browse Source

feat(nocodb): add ajv-formats

pull/5222/head
Wing-Kam Wong 2 years ago
parent
commit
91d8dd6a31
  1. 25
      packages/nocodb/package-lock.json
  2. 1
      packages/nocodb/package.json
  3. 2
      packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts

25
packages/nocodb/package-lock.json generated

@ -14,6 +14,7 @@
"@sentry/node": "^6.3.5",
"airtable": "^0.11.3",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"archiver": "^5.0.2",
"auto-bind": "^4.0.0",
"aws-sdk": "^2.829.0",
@ -2261,6 +2262,22 @@
"ajv": ">=5.0.0"
}
},
"node_modules/ajv-formats": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
"integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
"dependencies": {
"ajv": "^8.0.0"
},
"peerDependencies": {
"ajv": "^8.0.0"
},
"peerDependenciesMeta": {
"ajv": {
"optional": true
}
}
},
"node_modules/amdefine": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
@ -20919,6 +20936,14 @@
"dev": true,
"requires": {}
},
"ajv-formats": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
"integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
"requires": {
"ajv": "^8.0.0"
}
},
"amdefine": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",

1
packages/nocodb/package.json

@ -55,6 +55,7 @@
"@sentry/node": "^6.3.5",
"airtable": "^0.11.3",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"archiver": "^5.0.2",
"auto-bind": "^4.0.0",
"aws-sdk": "^2.829.0",

2
packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts

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

Loading…
Cancel
Save