You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.11.0
Plugin version
3.5.0
Node.js version
v18.4.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.0.1 (22A400)
Description
The schemaController.compilersFactory.buildValidator property that can be passed to the Fastify-function is not of the same type as the return value of StandaloneValidator anymore.
Here is the error:
error TS2769: No overload matches this call.
The last overload gave the following error.
Type '{ (externalSchemas: { [key: string]: AnySchema | AnySchema[]; }, options?: { mode: "JTD"; customOptions?: JTDOptions | undefined; } | undefined): AjvCompile; (externalSchemas: { ...; }, options?: { ...; } | undefined): AjvCompile; }' is not assignable to type 'ValidatorCompiler | undefined'.
Type '{ (externalSchemas: { [key: string]: AnySchema | AnySchema[]; }, options?: { mode: "JTD"; customOptions?: JTDOptions | undefined; } | undefined): AjvCompile; (externalSchemas: { ...; }, options?: { ...; } | undefined): AjvCompile; }' is not assignable to type 'AjvCompile'.
Types of parameters 'externalSchemas' and 'schema' are incompatible.
Type 'AnySchema' is not assignable to type '{ [key: string]: AnySchema | AnySchema[]; }'.
Type 'boolean' is not assignable to type '{ [key: string]: AnySchema | AnySchema[]; }'.
56 buildValidator: factory,
Steps to Reproduce
Check out this code snippet from the readme:
const{ StandaloneValidator }=require('@fastify/ajv-compiler')constfactory=StandaloneValidator({readMode: false,storeFunction(routeOpts,schemaValidationCode){// routeOpts is like: { schema, method, url, httpPart }// schemaValidationCode is a string source code that is the compiled schema functionconstfileName=generateFileName(routeOpts)fs.writeFileSync(path.join(__dirname,fileName),schemaValidationCode)}})constapp=fastify({jsonShorthand: false,schemaController: {compilersFactory: {buildValidator: factory// this does not compile anymore}}})
Expected Behavior
It should compile.
The text was updated successfully, but these errors were encountered:
brodo
changed the title
Standalone stops working when updating from 3.4.0 to 3.5.0
Standalone stops compiling when updating from 3.4.0 to 3.5.0
Jan 10, 2023
Prerequisites
Fastify version
4.11.0
Plugin version
3.5.0
Node.js version
v18.4.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.0.1 (22A400)
Description
The
schemaController.compilersFactory.buildValidator
property that can be passed to theFastify
-function is not of the same type as the return value ofStandaloneValidator
anymore.Here is the error:
Steps to Reproduce
Check out this code snippet from the readme:
Expected Behavior
It should compile.
The text was updated successfully, but these errors were encountered: