-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Do not allow to specify iterable-only options on non-iterable …
…queries This only changes the interfaces (client & smart contract) to be less error-prone, doing so is already a runtime error Signed-off-by: Nikita Strygin <[email protected]>
- Loading branch information
Showing
7 changed files
with
145 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![cfg(not(coverage))] | ||
use trybuild::TestCases; | ||
|
||
#[test] | ||
fn ui() { | ||
let test_cases = TestCases::new(); | ||
test_cases.compile_fail("tests/ui_fail/*.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use iroha_client::{ | ||
client::{self, Client}, | ||
config::Config, | ||
data_model::query::predicate::{string, value, PredicateBox}, | ||
}; | ||
|
||
fn main() { | ||
let config = Config::load("../configs/swarm/client.toml").unwrap(); | ||
|
||
let client = Client::new(config); | ||
|
||
let result = client | ||
.build_query(client::permission::permission_schema()) | ||
.with_filter(PredicateBox::new( | ||
value::QueryOutputPredicate::Identifiable(string::StringPredicate::starts_with("xor_")), | ||
)) | ||
.execute() | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error[E0599]: the method `with_filter` exists for struct `QueryRequestBuilder<'_, FindPermissionSchema>`, but its trait bounds were not satisfied | ||
--> tests/ui_fail/cant_filter_singular_query.rs:14:10 | ||
| | ||
12 | let result = client | ||
| __________________- | ||
13 | | .build_query(client::permission::permission_schema()) | ||
14 | | .with_filter(PredicateBox::new( | ||
| | -^^^^^^^^^^^ method cannot be called on `QueryRequestBuilder<'_, FindPermissionSchema>` due to unsatisfied trait bounds | ||
| |_________| | ||
| | ||
| | ||
::: $WORKSPACE/data_model/src/query/mod.rs | ||
| | ||
| / queries! { | ||
| | /// Finds all registered permission tokens | ||
| | #[derive(Copy, Display)] | ||
| | #[ffi_type] | ||
... | | ||
| | } | ||
| | } | ||
| |_____- doesn't satisfy `_: IterableQuery` | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`iroha_client::iroha_data_model::prelude::FindPermissionSchema: IterableQuery` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters