-
-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Labels
feature 🚀New feature or requestNew feature or request
Description
@mrlubos would it be possible to customise the responseValidator ?
Currently it generates a :
responseValidator: async (data) => {
return await zXXXResponse.parseAsync(data);
},but I want the request to succeed and just log it / show a notification in dev mode, but currently it is not possible, because in the client, the request config is always applied, maybe the request could just transport the zod schema,
responseType: 'json',
schema: zXXXResponse,
url: '/XXX',and the client could be :
if (opts.responseValidator) {
await opts.responseValidator(data, schema);
}and the default responseValidator could be :
responseValidator: async (data, schema) => {
return await schema.parseAsync(data);
},so we could do
responseValidator: async (data, schema) => {
const result = await schema.safeParseAsync(data);
console.log(result);
notify(result);
},Originally posted by @amarant in #876 (comment)
amarant
Metadata
Metadata
Assignees
Labels
feature 🚀New feature or requestNew feature or request