rsuite / schema-typed

Schema for data modeling & validation
MIT License
198 stars 28 forks source link

feat: add support for `equalTo` and `proxy` #78

Closed simonguo closed 5 months ago

simonguo commented 5 months ago

equalTo(fieldName: string, errorMessage?: string)

Check if the value is equal to the value of another field.

SchemaModel({
  password: StringType().isRequired(),
  confirmPassword: StringType().equalTo('password')
});

proxy(fieldNames: string[], options?: { checkIfValueExists?: boolean })

After the field verification passes, proxy verification of other fields.

SchemaModel({
  password: StringType().isRequired().proxy(['confirmPassword']),
  confirmPassword: StringType().equalTo('password')
});
forispeti commented 5 months ago

This change causes issues with rsuite's form. The schema model is updated here but not in the checking functions of the form(referring to Schema.ts line 13, spec to $spec)

simonguo commented 5 months ago

This change causes issues with rsuite's form. The schema model is updated here but not in the checking functions of the form(referring to Schema.ts line 13, spec to $spec)

Thanks, rsuite will also be released after the update today