Skip to content

Commit

Permalink
remove querymsg attributes before function construction (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberHoward authored Jun 20, 2023
1 parent af8e10d commit 6cbf394
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/mock_contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ pub enum ExecuteMsg<T = String> {
FirstMessage {},
#[cfg_attr(feature = "interface", payable)]
SecondMessage {
/// test doc-comment
t: T,
},
/// test doc-comment
ThirdMessage {
/// test doc-comment
t: T,
},
}
Expand All @@ -26,9 +29,13 @@ pub enum ExecuteMsg<T = String> {
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(String)]
/// test-doc-comment
FirstQuery {},
#[returns(String)]
SecondQuery { t: String },
SecondQuery {
/// test doc-comment
t: String,
},
}

#[cw_serde]
Expand Down
1 change: 1 addition & 0 deletions packages/cw-orch-fns-derive/src/execute_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub fn execute_fns_derive(input: DeriveInput) -> TokenStream {

// parse these fields as arguments to function
let mut variant_idents = variant_fields.named.clone();

// remove any attributes for use in fn arguments
variant_idents.iter_mut().for_each(|f| f.attrs = vec![]);

Expand Down
3 changes: 3 additions & 0 deletions packages/cw-orch-fns-derive/src/query_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub fn query_fns_derive(input: ItemEnum) -> TokenStream {
// sort fields on field name
LexiographicMatching::default().visit_fields_named_mut(variant_fields);

// remove attributes from fields
variant_fields.named.iter_mut().for_each(|f| f.attrs = vec![]);

// Parse these fields as arguments to function
let variant_fields = variant_fields.named.clone();
let variant_idents = variant_fields.iter().map(|f|f.ident.clone().unwrap());
Expand Down

0 comments on commit 6cbf394

Please sign in to comment.