Skip to content

Commit b85f193

Browse files
committed
distinguish ContentRule with the TemplateRule
1 parent 90c3a50 commit b85f193

File tree

6 files changed

+658
-437
lines changed

6 files changed

+658
-437
lines changed

rust/catalyst-signed-doc-macro/src/rules/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ pub(crate) fn catalyst_signed_documents_rules_impl() -> anyhow::Result<TokenStre
2626
exp: ContentEncoding::Brotli,
2727
optional: false,
2828
},
29-
content: crate::validator::rules::ContentRule::NotSpecified,
29+
template: crate::validator::rules::TemplateRule::NotSpecified,
3030
parameters: crate::validator::rules::ParametersRule::NotSpecified,
3131
doc_ref: #ref_rule,
3232
reply: crate::validator::rules::ReplyRule::NotSpecified,
3333
section: crate::validator::rules::SectionRule::NotSpecified,
34+
content: crate::validator::rules::ContentRule::Nil,
3435
kid: crate::validator::rules::SignatureKidRule {
3536
exp: &[],
3637
},

rust/signed_doc/src/validator/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
},
2020
metadata::DocType,
2121
providers::{CatalystSignedDocumentProvider, VerifyingKeyProvider},
22-
validator::rules::SignatureRule,
22+
validator::rules::{SignatureRule, TemplateRule},
2323
CatalystSignedDocument, ContentEncoding, ContentType,
2424
};
2525

@@ -48,8 +48,8 @@ fn proposal_rule() -> Rules {
4848
exp: ContentEncoding::Brotli,
4949
optional: false,
5050
},
51-
content: ContentRule::Templated {
52-
exp_template_type: PROPOSAL_FORM_TEMPLATE.clone(),
51+
template: TemplateRule::Specified {
52+
allowed_type: PROPOSAL_FORM_TEMPLATE.clone(),
5353
},
5454
parameters: ParametersRule::Specified {
5555
exp_parameters_type: parameters.clone(),
@@ -58,6 +58,7 @@ fn proposal_rule() -> Rules {
5858
doc_ref: RefRule::NotSpecified,
5959
reply: ReplyRule::NotSpecified,
6060
section: SectionRule::NotSpecified,
61+
content: ContentRule::NotNil,
6162
kid: SignatureKidRule {
6263
exp: &[RoleId::Proposer],
6364
},
@@ -86,8 +87,8 @@ fn proposal_comment_rule() -> Rules {
8687
exp: ContentEncoding::Brotli,
8788
optional: false,
8889
},
89-
content: ContentRule::Templated {
90-
exp_template_type: PROPOSAL_COMMENT_FORM_TEMPLATE.clone(),
90+
template: TemplateRule::Specified {
91+
allowed_type: PROPOSAL_COMMENT_FORM_TEMPLATE.clone(),
9192
},
9293
doc_ref: RefRule::Specified {
9394
exp_ref_types: vec![PROPOSAL.clone()],
@@ -103,6 +104,7 @@ fn proposal_comment_rule() -> Rules {
103104
exp_parameters_type: parameters.clone(),
104105
optional: false,
105106
},
107+
content: ContentRule::NotNil,
106108
kid: SignatureKidRule {
107109
exp: &[RoleId::Role0],
108110
},
@@ -142,7 +144,7 @@ fn proposal_submission_action_rule() -> Rules {
142144
exp: ContentEncoding::Brotli,
143145
optional: false,
144146
},
145-
content: ContentRule::Static(ContentSchema::Json(proposal_action_json_schema)),
147+
template: TemplateRule::NotSpecified,
146148
parameters: ParametersRule::Specified {
147149
exp_parameters_type: parameters,
148150
optional: false,
@@ -154,6 +156,7 @@ fn proposal_submission_action_rule() -> Rules {
154156
},
155157
reply: ReplyRule::NotSpecified,
156158
section: SectionRule::NotSpecified,
159+
content: ContentRule::StaticSchema(ContentSchema::Json(proposal_action_json_schema)),
157160
kid: SignatureKidRule {
158161
exp: &[RoleId::Proposer],
159162
},

0 commit comments

Comments
 (0)