generateArrayValidation()
generateArrayValidation(
varName,ctx,constraints?,customTypeMessage?):object
Experimental
Generates complete validation code for an array schema.
Parametersโ
varName: stringโ
The variable name to validate
ctx: GeneratorContextโ
The generator context
constraints?: ArrayConstraintMetaโ
Array constraint metadata
customTypeMessage?: stringโ
Optional custom type error message
Returns: objectโ
Generated code lines and updated context
code: string[]โ
ctx: GeneratorContextโ
Sinceโ
2.0.0
Exampleโ
const result = generateArrayValidation("value", ctx, {
minLength: { value: 1 },
maxLength: { value: 10 },
itemGenerator: stringGenerator
});