Openapi Schema improvements

- Return proper booleans in api responses
- Update jsonschemavalidation to latest draft
This commit is contained in:
Jamie Curnow
2024-10-10 15:53:11 +10:00
parent dfe2588523
commit 4572b205c9
69 changed files with 862 additions and 2082 deletions

View File

@ -1,11 +1,12 @@
const Ajv = require('ajv/dist/2020');
const error = require('../error');
const ajv = require('ajv')({
verbose: true,
validateSchema: true,
allErrors: false,
format: 'full',
coerceTypes: true
const ajv = new Ajv({
verbose: true,
allErrors: true,
allowUnionTypes: true,
strict: false,
coerceTypes: true,
});
/**
@ -25,8 +26,8 @@ function apiValidator (schema, payload/*, description*/) {
return;
}
let validate = ajv.compile(schema);
let valid = validate(payload);
const validate = ajv.compile(schema);
const valid = validate(payload);
if (valid && !validate.errors) {
resolve(payload);