Rename the empty mutation type and hide __ fields from introspection
This makes GraphiQL stop emitting deprecation warnings
This commit is contained in:
parent
ab7e262f7c
commit
39e1cba49b
3 changed files with 6 additions and 2 deletions
|
@ -117,7 +117,7 @@ impl<'a> SchemaType<'a> {
|
|||
SchemaType {
|
||||
types: registry.types,
|
||||
query_type_name: query_type_name,
|
||||
mutation_type_name: if &mutation_type_name != "__EmptyMutation" { Some(mutation_type_name) } else { None },
|
||||
mutation_type_name: if &mutation_type_name != "_EmptyMutation" { Some(mutation_type_name) } else { None },
|
||||
directives: directives,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ impl<'a, CtxT, QueryT, MutationT> GraphQLType for RootNode<'a, QueryT, MutationT
|
|||
graphql_object!(<'a> SchemaType<'a>: SchemaType<'a> as "__Schema" |&self| {
|
||||
field types() -> Vec<TypeType> {
|
||||
self.type_list()
|
||||
.into_iter()
|
||||
.filter(|t| t.to_concrete().map(|t| t.name() != Some("_EmptyMutation")).unwrap_or(false))
|
||||
.collect()
|
||||
}
|
||||
|
||||
field query_type() -> TypeType {
|
||||
|
@ -84,6 +87,7 @@ graphql_object!(<'a> TypeType<'a>: SchemaType<'a> as "__Type" |&self| {
|
|||
Some(fields
|
||||
.iter()
|
||||
.filter(|f| include_deprecated || f.deprecation_reason.is_none())
|
||||
.filter(|f| !f.name.starts_with("__"))
|
||||
.collect()),
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ impl<T> GraphQLType for EmptyMutation<T> {
|
|||
type Context = T;
|
||||
|
||||
fn name() -> Option<&'static str> {
|
||||
Some("__EmptyMutation")
|
||||
Some("_EmptyMutation")
|
||||
}
|
||||
|
||||
fn meta<'r>(registry: &mut Registry<'r>) -> MetaType<'r> {
|
||||
|
|
Loading…
Reference in a new issue