Add fields to improve tooling compatibility
This adds some non-standard/deprecated fields to better work with tools such as GraphiQL or GraphQLViz.
This commit is contained in:
parent
eca20cd8ca
commit
20df66f8f0
1 changed files with 25 additions and 0 deletions
|
@ -44,6 +44,11 @@ graphql_object!(<'a> SchemaType<'a>: SchemaType<'a> as "__Schema" |&self| {
|
|||
self.mutation_type()
|
||||
}
|
||||
|
||||
// Included for compatibility with the introspection query in GraphQL.js
|
||||
field subscription_type() -> Option<TypeType> {
|
||||
None
|
||||
}
|
||||
|
||||
field directives() -> Vec<&DirectiveType> {
|
||||
self.directive_list()
|
||||
}
|
||||
|
@ -239,6 +244,26 @@ graphql_object!(<'a> DirectiveType<'a>: SchemaType<'a> as "__Directive" |&self|
|
|||
field args() -> &Vec<Argument> {
|
||||
&self.arguments
|
||||
}
|
||||
|
||||
// Included for compatibility with the introspection query in GraphQL.js
|
||||
field deprecated "Use the locations array instead"
|
||||
on_operation() -> bool {
|
||||
self.locations.contains(&DirectiveLocation::Query)
|
||||
}
|
||||
|
||||
// Included for compatibility with the introspection query in GraphQL.js
|
||||
field deprecated "Use the locations array instead"
|
||||
on_fragment() -> bool {
|
||||
self.locations.contains(&DirectiveLocation::FragmentDefinition) ||
|
||||
self.locations.contains(&DirectiveLocation::InlineFragment) ||
|
||||
self.locations.contains(&DirectiveLocation::FragmentSpread)
|
||||
}
|
||||
|
||||
// Included for compatibility with the introspection query in GraphQL.js
|
||||
field deprecated "Use the locations array instead"
|
||||
on_field() -> bool {
|
||||
self.locations.contains(&DirectiveLocation::Field)
|
||||
}
|
||||
});
|
||||
|
||||
graphql_enum!(DirectiveLocation as "__DirectiveLocation" {
|
||||
|
|
Loading…
Reference in a new issue