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
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20
Description
AJV error object is like this,
exportinterfaceErrorObject<Kextendsstring=string,P=Record<string,any>,S=unknown>{keyword: KinstancePath: stringschemaPath: stringparams: P// Added to validation errors of "propertyNames" keyword schemapropertyName?: string// Excluded if option `messages` set to false.message?: string// These are added with the `verbose` option.schema?: SparentSchema?: AnySchemaObjectdata?: unknown}
In version 3 of Fastify (and the AJV version it used), AJV errors were directly assignable to ValidationResult type and vice verca.
But in v4 the types mismatch. looks like AJV no longer has the dataPath key. It was changed here.
Edit:
Maybe fastify is internally converting the ErrorObject to a ValidationError. In that case, it wouldn't be an issuue. But it maybe the case that, fastify is not handling this new ErrorObject properly.
The text was updated successfully, but these errors were encountered:
Adding more info for whoever picks this up, in lib/context.js it looks like defaultSchemaErrorFormatter is using instancePath so it's the type defs that are outdated.
Prerequisites
Fastify version
4
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20
Description
AJV error object is like this,
Fastify type is like this,
In version 3 of Fastify (and the AJV version it used), AJV errors were directly assignable to ValidationResult type and vice verca.
But in v4 the types mismatch. looks like AJV no longer has the
dataPath
key. It was changed here.Steps to Reproduce
Try this in v3 and v4 projects.
Expected Behavior
Edit:
Maybe fastify is internally converting the ErrorObject to a ValidationError. In that case, it wouldn't be an issuue. But it maybe the case that, fastify is not handling this new ErrorObject properly.
The text was updated successfully, but these errors were encountered: