Skip to content

Commit

Permalink
[fix] hyperledger#1969: Update schema to distinguish SmallVec and `…
Browse files Browse the repository at this point in the history
…Vec` types.

Signed-off-by: Aleksandr <a-p-petrosyan@yandex.ru>
  • Loading branch information
appetrosyan committed Mar 16, 2022
1 parent 2dac89e commit 11cd760
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod multisignature_transaction;
mod offline_peers;
mod pagination;
mod permissions;
mod query;
mod restart_peer;
mod transfer_asset;
mod tx_history;
Expand Down
34 changes: 34 additions & 0 deletions client/tests/integration/query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#![allow(clippy::restriction)]

use eyre::Result;
use iroha_client::client;
// use iroha_core::config::Configuration;
use iroha_data_model::prelude::*;
use parity_scale_codec::Encode;
use test_network::{Peer as TestPeer, *};

#[test]
fn find_all_domains_regression_test() -> Result<()> {
let (_rt, _peer, mut test_client) = <TestPeer>::start_test_with_runtime();
wait_for_genesis_committed(vec![test_client.clone()], 0);
// let pipeline_time = Configuration::pipeline_time();

// Given

let normal_domain_name = "sora";
let create_domain = RegisterBox::new(IdentifiableBox::from(Domain::test(normal_domain_name)));
test_client.submit(create_domain)?;

let reply = test_client.request(FindDomainById::new(
DomainId::new("genesis").expect("Valid"),
))?;
println!("{:#?}", reply);
let reply = test_client.request(FindAccountsByDomainId::new(
DomainId::new("genesis").expect("Valid"),
))?;
println!("{:#?}", reply);
println!("{}", String::from_utf8_lossy(&reply.encode()));
let reply = test_client.request(FindAllAccounts::new())?;
println!("{:#?}", reply);
Ok(())
}
5 changes: 3 additions & 2 deletions data_model/primitives/src/small.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ mod small_string {

impl IntoSchema for SmallStr {
fn type_name() -> String {
String::type_name()
"SmallString".to_owned()
}

fn schema(map: &mut MetaMap) {
String::schema(map);
}
Expand Down Expand Up @@ -217,7 +218,7 @@ mod small_vector {

impl<T: IntoSchema, A: smallvec::Array<Item = T>> IntoSchema for SmallVec<A> {
fn type_name() -> String {
Vec::<T>::type_name()
format!("SmallVec<{}>", T::type_name())
}

fn schema(map: &mut MetaMap) {
Expand Down

0 comments on commit 11cd760

Please sign in to comment.