Skip to content

Commit d3e855e

Browse files
authored
Merge pull request #99 from h-michael/graphql-client-codegen
Add new crate, graphql_client_codegen
2 parents 9a0bce4 + 39f53c8 commit d3e855e

33 files changed

+224
-185
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ members = [
2323
"examples/example_module",
2424
"examples/github",
2525
"graphql_query_derive",
26+
"graphql_client_codegen",
2627
"graphql_client_cli",
2728
]

examples/example_module/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ use custom_scalars::*;
1212
#[graphql(
1313
schema_path = "../github/src/schema.graphql",
1414
query_path = "../github/src/query_1.graphql",
15-
response_derives = "Debug",
15+
response_derives = "Debug"
1616
)]
1717
pub struct ExampleModule;

graphql_client_codegen/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

graphql_client_codegen/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "graphql_client_codegen"
3+
version = "0.4.0"
4+
authors = ["Tom Houlé <tom@tomhoule.com>"]
5+
description = "Utility crate for graphql_client"
6+
license = "Apache-2.0 OR MIT"
7+
repository = "https://github.com/tomhoule/graphql-client"
8+
9+
[dependencies]
10+
failure = "0.1"
11+
itertools = "0.7"
12+
lazy_static = "1.0"
13+
quote = "^0.6"
14+
syn = "0.14"
15+
proc-macro2 = { version = "0.4", features = [] }
16+
serde = "1.0"
17+
serde_derive = "1.0"
18+
serde_json = "1.0"
19+
heck = "0.3"
20+
graphql-parser = "0.2"

graphql_query_derive/src/attributes.rs renamed to graphql_client_codegen/src/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use failure;
22
use syn;
33

4-
pub(crate) fn extract_attr(ast: &syn::DeriveInput, attr: &str) -> Result<String, failure::Error> {
4+
pub fn extract_attr(ast: &syn::DeriveInput, attr: &str) -> Result<String, failure::Error> {
55
let attributes = &ast.attrs;
66
let attribute = attributes
77
.iter()

graphql_query_derive/src/codegen.rs renamed to graphql_client_codegen/src/codegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use query::QueryContext;
88
use schema;
99
use selection::Selection;
1010

11-
pub(crate) fn response_for_query(
11+
pub fn response_for_query(
1212
schema: schema::Schema,
1313
query: query::Document,
1414
selected_operation: String,

graphql_query_derive/src/deprecation.rs renamed to graphql_client_codegen/src/deprecation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ pub enum DeprecationStatus {
1111
}
1212

1313
#[derive(Debug, PartialEq)]
14-
pub(crate) enum DeprecationStrategy {
14+
pub enum DeprecationStrategy {
1515
Allow,
1616
Deny,
1717
Warn,
1818
}
1919

20-
pub(crate) fn extract_deprecation_strategy(
20+
pub fn extract_deprecation_strategy(
2121
ast: &syn::DeriveInput,
2222
) -> Result<DeprecationStrategy, failure::Error> {
2323
match attributes::extract_attr(&ast, "deprecated")?

0 commit comments

Comments
 (0)