11//! Catalyst Signed Documents validation
22
3- #![ allow( dead_code) ]
4-
53pub ( crate ) mod rules;
64pub ( crate ) mod utils;
75
86use std:: { collections:: HashMap , sync:: LazyLock } ;
97
108use catalyst_types:: uuid:: Uuid ;
11- use rules:: { ContentEncodingRule , ContentTypeRule , Rules } ;
9+ use rules:: {
10+ CategoryRule , ContentEncodingRule , ContentTypeRule , RefRule , ReplyRule , Rules , SectionRule ,
11+ TemplateRule ,
12+ } ;
1213
1314use crate :: {
14- doc_types:: { COMMENT_DOCUMENT_UUID_TYPE , PROPOSAL_DOCUMENT_UUID_TYPE } ,
15+ doc_types:: {
16+ COMMENT_DOCUMENT_UUID_TYPE , COMMENT_TEMPLATE_UUID_TYPE , PROPOSAL_DOCUMENT_UUID_TYPE ,
17+ PROPOSAL_TEMPLATE_UUID_TYPE ,
18+ } ,
1519 providers:: CatalystSignedDocumentProvider ,
1620 CatalystSignedDocument , ContentEncoding , ContentType ,
1721} ;
@@ -22,7 +26,7 @@ static DOCUMENT_RULES: LazyLock<HashMap<Uuid, Rules>> = LazyLock::new(document_r
2226/// `DOCUMENT_RULES` initialization function
2327fn document_rules_init ( ) -> HashMap < Uuid , Rules > {
2428 let mut document_rules_map = HashMap :: new ( ) ;
25-
29+
2630 let proposal_document_rules = Rules {
2731 content_type : ContentTypeRule {
2832 exp : ContentType :: Json ,
@@ -31,6 +35,13 @@ fn document_rules_init() -> HashMap<Uuid, Rules> {
3135 exp : ContentEncoding :: Brotli ,
3236 optional : false ,
3337 } ,
38+ template : TemplateRule :: Specified {
39+ exp_template_type : PROPOSAL_TEMPLATE_UUID_TYPE ,
40+ } ,
41+ category : CategoryRule :: Specified { optional : false } ,
42+ doc_ref : RefRule :: NotSpecified ,
43+ reply : ReplyRule :: NotSpecified ,
44+ section : SectionRule :: NotSpecified ,
3445 } ;
3546 document_rules_map. insert ( PROPOSAL_DOCUMENT_UUID_TYPE , proposal_document_rules) ;
3647
@@ -42,6 +53,19 @@ fn document_rules_init() -> HashMap<Uuid, Rules> {
4253 exp : ContentEncoding :: Brotli ,
4354 optional : false ,
4455 } ,
56+ template : TemplateRule :: Specified {
57+ exp_template_type : COMMENT_TEMPLATE_UUID_TYPE ,
58+ } ,
59+ doc_ref : RefRule :: Specified {
60+ exp_ref_type : PROPOSAL_DOCUMENT_UUID_TYPE ,
61+ optional : false ,
62+ } ,
63+ reply : ReplyRule :: Specified {
64+ exp_reply_type : COMMENT_DOCUMENT_UUID_TYPE ,
65+ optional : true ,
66+ } ,
67+ section : SectionRule :: Specified { optional : true } ,
68+ category : CategoryRule :: NotSpecified ,
4569 } ;
4670 document_rules_map. insert ( COMMENT_DOCUMENT_UUID_TYPE , comment_document_rules) ;
4771
0 commit comments