Finds the closest schema to the input arguments.
This is a helper function that identifies the closest schema to the input arguments, in the case of an initial validation error. We will then use the closest schema to generate a friendly error message.
Examples
Syntax
findClosestSchema(schema, args)
Parameters
schema
z.ZodSchema: Zod schema.
args
Array: User input arguments.
Returns
z.ZodSchema: Closest schema matching the input arguments.
Notice any errors or typos? Please let us know. Please feel free to edit src/core/friendly_errors/param_validator.js and open a pull request!