-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support query_string macro attribute
Add test for query string attribute
- Loading branch information
Showing
3 changed files
with
108 additions
and
55 deletions.
There are no files selected for viewing
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,18 @@ | ||
use graphql_client::*; | ||
|
||
#[derive(GraphQLQuery)] | ||
#[graphql( | ||
query_string = "query FromQueryString { s }", | ||
schema_path = "tests/query_string/schema.graphql" | ||
)] | ||
struct FromQueryString; | ||
|
||
#[test] | ||
fn response_serialization() { | ||
const RESPONSE: &str = r#"{"s": "something"}"#; | ||
|
||
let response: from_query_string::ResponseData = serde_json::from_str(RESPONSE).unwrap(); | ||
let s = response.s.unwrap(); | ||
|
||
assert_eq!("something", s); | ||
} |
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,7 @@ | ||
schema { | ||
query: QueryRoot | ||
} | ||
|
||
type QueryRoot { | ||
s: String | ||
} |
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