You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
anyhow::ensure!(spec.doc_type.len() == 1,"'type' field should exists and has only one entry for the required 'reply' metadata definition");
43
+
anyhow::ensure!(
44
+
spec.multiple.is_some_and(|v| !v),
45
+
"'multiple' field should be only set to false for the required 'reply' metadata definition"
46
+
);
47
+
48
+
let doc_name = spec.doc_type.first().ok_or(anyhow::anyhow!("'type' field should exists and has only one entry for the required 'reply' metadata definition"))?;
49
+
let docs_spec = docs.get(doc_name).ok_or(anyhow::anyhow!(
50
+
"cannot find a document definition {doc_name}"
51
+
))?;
52
+
let allowed_type = docs_spec.doc_type.as_str().parse()?;
53
+
54
+
Ok(Self::Specified{
55
+
allowed_type,
56
+
optional,
57
+
})
58
+
}
59
+
23
60
/// Field validation rule
24
61
pub(crate)asyncfncheck<Provider>(
25
62
&self,
@@ -31,7 +68,7 @@ impl ReplyRule {
31
68
{
32
69
let context:&str = "Reply rule check";
33
70
ifletSelf::Specified{
34
-
exp_reply_type,
71
+
allowed_type:exp_reply_type,
35
72
optional,
36
73
} = self
37
74
{
@@ -339,15 +376,15 @@ mod tests {
339
376
let doc = doc_gen(exp_type.clone(),&mut provider);
0 commit comments