@fastify/ajv-compiler
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -7,3 +7,3 @@ 'use strict' | ||
function ValidatorSelector (opts) { | ||
function AjvCompiler (opts) { | ||
const validatorPool = new Map() | ||
@@ -50,4 +50,6 @@ const serializerPool = new Map() | ||
} | ||
module.exports = ValidatorSelector | ||
module.exports = AjvCompiler | ||
module.exports.default = AjvCompiler | ||
module.exports.AjvCompiler = AjvCompiler | ||
module.exports.AjvReference = AjvReference | ||
module.exports.StandaloneValidator = require('./standalone') |
{ | ||
"name": "@fastify/ajv-compiler", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Build and manage the AJV instances for the fastify framework", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"types": "types/index.d.ts", | ||
"directories": { | ||
@@ -13,3 +13,3 @@ "test": "test" | ||
"lint:fix": "standard --fix", | ||
"unit": "tap test/**/*.test.js", | ||
"unit": "tap", | ||
"test": "npm run unit && npm run test:typescript", | ||
@@ -49,3 +49,3 @@ "posttest": "rimraf test/ajv-generated*.js", | ||
"tap": "^16.2.0", | ||
"tsd": "^0.24.1" | ||
"tsd": "^0.25.0" | ||
}, | ||
@@ -56,6 +56,3 @@ "dependencies": { | ||
"fast-uri": "^2.0.0" | ||
}, | ||
"tsd": { | ||
"directory": "test/types" | ||
} | ||
} |
@@ -244,1 +244,37 @@ 'use strict' | ||
}) | ||
t.test('fastify integration within JTD serializer and custom options', async t => { | ||
const factorySerializer = AjvCompiler({ jtdSerializer: true }) | ||
const app = fastify({ | ||
jsonShorthand: false, | ||
serializerOpts: { | ||
allErrors: true, | ||
logger: 'wrong-value' | ||
}, | ||
schemaController: { | ||
compilersFactory: { | ||
buildSerializer: factorySerializer | ||
} | ||
} | ||
}) | ||
app.post('/', { | ||
schema: { | ||
response: { | ||
200: { | ||
properties: { | ||
test: { type: 'boolean' } | ||
} | ||
} | ||
} | ||
} | ||
}, async () => { }) | ||
try { | ||
await app.ready() | ||
t.fail('should throw') | ||
} catch (error) { | ||
t.equal(error.message, 'logger must implement log, warn and error methods', 'the wrong setting is forwarded to ajv/jtd') | ||
} | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50849
1374
22