Skip to content

Commit 8da1716

Browse files
committed
add enums
1 parent 01ad6d0 commit 8da1716

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

graphql_query_derive/src/enums.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub const ENUMS_PREFIX: &str = "";
44

55
#[derive(Debug, PartialEq)]
66
pub struct GqlEnum {
7+
pub description: Option<String>,
78
pub name: String,
89
pub variants: Vec<String>,
910
}

graphql_query_derive/src/schema.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ impl ::std::convert::From<graphql_parser::schema::Document> for Schema {
267267
enm.name.clone(),
268268
GqlEnum {
269269
name: enm.name.clone(),
270+
description: enm.description,
270271
variants: enm.values.iter().map(|v| v.name.clone()).collect(),
271272
},
272273
);
@@ -349,9 +350,12 @@ impl ::std::convert::From<::introspection_response::IntrospectionResponse> for S
349350
.map(|t| t.clone().map(|t| t.name.expect("enum variant name")))
350351
.filter_map(|t| t)
351352
.collect();
352-
schema
353-
.enums
354-
.insert(name.clone(), GqlEnum { name, variants });
353+
let mut enm = GqlEnum {
354+
name: name.clone(),
355+
description: ty.description.clone(),
356+
variants,
357+
};
358+
schema.enums.insert(name, enm);
355359
}
356360
Some(__TypeKind::SCALAR) => {
357361
if DEFAULT_SCALARS

0 commit comments

Comments
 (0)