Can someone help me understand the validator functionality in addtionalFields?

So you can have additional fields, and have a zod schema to validate the field

so I guess validator input is the validation schema, and output is for transforming data through zod?

or do I have it wrong and is it reversed.

Can I have a zodschema that performs transformation in input? Or would I create two schema's, one for validation and one for transformation?

Are there any resources about this? Or is this common zod/ts knowledge?

codesnippet of what i'm trying to do (normalising phone numbers)


 typescript
    additionalFields: {
      status: {
        type: "string",
        defaultValue: "active",
        input: false,
        validator: {
          input: userStatus,
          output: ?
        },
      },
      phoneNumber: {
        type: "string",
        input: false,
        validator: {
          input: userPhoneNumber,
          output: ?
        }
      }
    }
  },
}
Was this page helpful?