Forced field validation when the field is empty?
vsilent opened this issue · 1 comments
vsilent commented
It looks like field is validated anyway, even it's wrapped with the Option, is it default behaviour or a bug?
for example:
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, Validate)]
pub struct Port {
#[validate(pattern = r"^\d{2,6}+$")]
pub host_port: Option<String>,
I expected this field not to be validated when empty or should I use rules for that case ?
vsilent commented
Sorry my bad, not an issue, because I get Some("") not None