Skip to content

Commit

Permalink
use get_schema_derive inside NearSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyProgrammist committed Mar 22, 2024
1 parent b36c3c4 commit 8fccbd6
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions near-sdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub fn near(attr: TokenStream, item: TokenStream) -> TokenStream {
abis = quote! { #[abi(json)] };
}

// let schema_derive = get_schema_derive(has_json, has_borsh, near_sdk_crate.clone(), false);
let schema_derive = get_schema_derive(has_json, has_borsh, near_sdk_crate.clone(), false);

let expanded;
if let Ok(input) = syn::parse::<ItemStruct>(item.clone()) {
Expand Down Expand Up @@ -665,23 +665,7 @@ pub fn derive_near_schema(#[allow(unused)] input: TokenStream) -> TokenStream {
// <unspecified> or #[abi(json)]
let json_schema = json_schema || !borsh_schema;

let derive = {
let mut derive = quote! {};
if borsh_schema {
derive = quote! {
#[derive(#near_sdk_crate::borsh::BorshSchema)]
#[borsh(crate = #string_borsh_crate)]
};
}
if json_schema {
derive = quote! {
#derive
#[derive(#near_sdk_crate::schemars::JsonSchema)]
#[schemars(crate = #string_schemars_crate)]
};
}
derive
};
let derive = get_schema_derive(json_schema, borsh_schema, near_sdk_crate.clone(), true);

let input_ident = &input.ident;

Expand Down

0 comments on commit 8fccbd6

Please sign in to comment.