File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 33 FastifyPluginCallback ,
44 FastifyPluginOptions ,
55 FastifySchemaCompiler ,
6+ FastifySchemaValidationError ,
67 FastifyTypeProvider ,
78 RawServerBase ,
89 RawServerDefault
@@ -23,25 +24,15 @@ export * from 'typebox'
2324 */
2425export const TypeBoxValidatorCompiler : FastifySchemaCompiler < TSchema > = ( { schema, httpPart } ) => {
2526 const typeCheck = Compile ( schema )
26- return ( value ) : any => {
27+ return ( value ) : any /* TODO: remove any for next major */ => {
2728 // Note: Only support value conversion for querystring, params and header schematics
2829 const converted = httpPart === 'body' ? value : Value . Convert ( schema , value )
2930 if ( typeCheck . Check ( converted ) ) {
3031 return { value : converted }
3132 }
32- const errors = [ ]
33- for ( const error of typeCheck . Errors ( converted ) ) {
34- errors . push ( {
35- message : error . message ,
36- instancePath : error . instancePath
37- } )
38- }
33+ const errors : FastifySchemaValidationError [ ] = typeCheck . Errors ( converted ) ;
3934 return {
40- // Note: Here we return a FastifySchemaValidationError[] result. As of writing, Fastify
41- // does not currently export this type. Future revisions should uncomment the assertion
42- // below and return the full set of properties. The specified properties 'message' and
43- // 'instancePath' do however result in a near equivalent error messages to Ajv.
44- error : errors // as FastifySchemaValidationError[]
35+ error : errors
4536 }
4637 }
4738}
You can’t perform that action at this time.
0 commit comments