Trait cosmwasm_schema::QueryResponses
source · [−]pub trait QueryResponses: JsonSchema {
fn response_schemas_impl() -> BTreeMap<String, RootSchema>;
fn response_schemas(
) -> Result<BTreeMap<String, RootSchema>, IntegrityError> { ... }
}
Expand description
A trait for tying QueryMsg variants (different contract queries) to their response types.
This is mostly useful for the generated contracted API description when using cargo schema
.
Using the derive macro is the preferred way of implementing this trait.
Example
use cosmwasm_schema::QueryResponses;
use schemars::JsonSchema;
#[derive(JsonSchema)]
struct AccountInfo {
IcqHandle: String,
}
#[derive(JsonSchema, QueryResponses)]
enum QueryMsg {
#[returns(Vec<String>)]
Denoms {},
#[returns(AccountInfo)]
AccountInfo { account: String },
}
Required Methods
source
fn response_schemas_impl() -> BTreeMap<String, RootSchema>
Provided Methods
source