forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectives.java
More file actions
39 lines (31 loc) · 1.31 KB
/
Directives.java
File metadata and controls
39 lines (31 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package graphql;
import graphql.schema.GraphQLDirective;
import graphql.schema.GraphQLNonNull;
import static graphql.Scalars.GraphQLBoolean;
import static graphql.schema.GraphQLArgument.newArgument;
public class Directives {
public static GraphQLDirective IncludeDirective = GraphQLDirective.newDirective()
.name("include")
.description("Directs the executor to include this field or fragment only when the `if` argument is true")
.argument(newArgument()
.name("if")
.type(new GraphQLNonNull(GraphQLBoolean))
.description("Included when true.")
.build())
.onOperation(false)
.onFragment(true)
.onField(true)
.build();
public static GraphQLDirective SkipDirective = GraphQLDirective.newDirective()
.name("skip")
.description("Directs the executor to skip this field or fragment when the `if`'argument is true.")
.argument(newArgument()
.name("skip")
.type(new GraphQLNonNull(GraphQLBoolean))
.description("Skipped when true.")
.build())
.onOperation(false)
.onFragment(true)
.onField(true)
.build();
}