Derive Macro NearSchema

Source
#[derive(NearSchema)]
{
    // Attributes available to this derive:
    #[abi]
    #[serde]
    #[borsh]
    #[schemars]
    #[validate]
    #[inside_nearsdk]
}
Expand description

NearSchema is a derive macro that generates BorshSchema and / or JsonSchema implementations. Use #[abi(json)] attribute to generate code for JsonSchema. And #[abi(borsh)] for BorshSchema. You can use both and none as well.

§Example

#[derive(NearSchema)]
#[abi(borsh)]
struct Value {
   field: InnerValue,
}

In this example, BorshSchema will be generated for Value struct.