message: test for QueryMsgs with generics implementing QueryResponses
diff: @@ -106,3 +106,43 @@ fn test_query_responses() {
  // Find the "balance" query in responses
  api.get("responses").unwrap().get("balance").unwrap();
  }
  +
  +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)]
  +#[serde(rename_all = "snake_case")]
  +pub enum QueryMsgWithGenerics<T: std::fmt::Debug>
  +where
  + T: JsonSchema,
  +{
  + #[returns(u128)]
  + QueryData { data: T },
  +}
  +
  +#[test]
  +fn test_query_responses_generics() {
  + let api_str = generate_api! {
  + instantiate: InstantiateMsg,
  + query: QueryMsgWithGenerics<u32>,
  + }
  + .render()
  + .to_string()
  + .unwrap();
  +
  + let api: Value = serde_json::from_str(&api_str).unwrap();
  + let queries = api
  + .get("query")
  + .unwrap()
  + .get("oneOf")
  + .unwrap()
  + .as_array()
  + .unwrap();
  +
  + // Find the "balance" query in the queries schema
  + assert_eq!(queries.len(), 1);
  + assert_eq!(
  + queries[0].get("required").unwrap().get(0).unwrap(),
  + "query_data"
  + );
  +
  + // Find the "balance" query in responses
  + api.get("responses").unwrap().get("query_data").unwrap();
  +}
  