Skip to content

Commit 777b0d4

Browse files
sujayakarLegNeato
andauthored
Don't require () TypeInfo for schema language methods (#935)
* Don't require `()` TypeInfo for schema language methods * Add PR to CHANGELOG.md Co-authored-by: Christian Legnitto <[email protected]>
1 parent 2cb026f commit 777b0d4

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

juniper/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# master
22

3-
- No changes yet
3+
- Allow `RootNode::as_schema_language` and `RootNode::as_parser_document` for arbitrary type info ([#935](https://github.com/graphql-rust/juniper/pull/935))
44

55
# [[0.15.5] 2021-05-11](https://github.com/graphql-rust/juniper/releases/tag/juniper-v0.15.5)
66

juniper/src/schema/model.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,6 @@ where
118118
) -> Self {
119119
RootNode::new_with_info(query, mutation, subscription, (), (), ())
120120
}
121-
122-
#[cfg(feature = "schema-language")]
123-
/// The schema definition as a `String` in the
124-
/// [GraphQL Schema Language](https://graphql.org/learn/schema/#type-language)
125-
/// format.
126-
pub fn as_schema_language(&self) -> String {
127-
let doc = self.as_parser_document();
128-
format!("{}", doc)
129-
}
130-
131-
#[cfg(feature = "graphql-parser-integration")]
132-
/// The schema definition as a [`graphql_parser`](https://crates.io/crates/graphql-parser)
133-
/// [`Document`](https://docs.rs/graphql-parser/latest/graphql_parser/schema/struct.Document.html).
134-
pub fn as_parser_document(&'a self) -> Document<'a, &'a str> {
135-
GraphQLParserTranslator::translate_schema(&self.schema)
136-
}
137121
}
138122

139123
impl<'a, S, QueryT, MutationT, SubscriptionT> RootNode<'a, QueryT, MutationT, SubscriptionT, S>
@@ -168,6 +152,22 @@ where
168152
subscription_info,
169153
}
170154
}
155+
156+
#[cfg(feature = "schema-language")]
157+
/// The schema definition as a `String` in the
158+
/// [GraphQL Schema Language](https://graphql.org/learn/schema/#type-language)
159+
/// format.
160+
pub fn as_schema_language(&self) -> String {
161+
let doc = self.as_parser_document();
162+
format!("{}", doc)
163+
}
164+
165+
#[cfg(feature = "graphql-parser-integration")]
166+
/// The schema definition as a [`graphql_parser`](https://crates.io/crates/graphql-parser)
167+
/// [`Document`](https://docs.rs/graphql-parser/latest/graphql_parser/schema/struct.Document.html).
168+
pub fn as_parser_document(&'a self) -> Document<'a, &'a str> {
169+
GraphQLParserTranslator::translate_schema(&self.schema)
170+
}
171171
}
172172

173173
impl<'a, S> SchemaType<'a, S> {

0 commit comments

Comments
 (0)