-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathIssue2141.groovy
More file actions
70 lines (55 loc) · 2.13 KB
/
Issue2141.groovy
File metadata and controls
70 lines (55 loc) · 2.13 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package graphql
import graphql.schema.idl.SchemaParser
import graphql.schema.idl.SchemaPrinter
import graphql.schema.idl.UnExecutableSchemaGenerator;
import spock.lang.Specification
class Issue2141 extends Specification {
def " remove redundant parenthesis "() {
when:
def schemaDesc = """
directive @auth(roles: [String!]) on FIELD_DEFINITION
type Query {
hello: String! @auth
}
"""
def schema = UnExecutableSchemaGenerator.makeUnExecutableSchema(new SchemaParser().parse(schemaDesc))
def schemaStr = new SchemaPrinter().print(schema)
then:
schemaStr == '''directive @auth(roles: [String!]) on FIELD_DEFINITION
"This directive allows results to be deferred during execution"
directive @defer(
"Deferred behaviour is controlled by this argument"
if: Boolean! = true,
"A unique label that represents the fragment being deferred"
label: String
) on FRAGMENT_SPREAD | INLINE_FRAGMENT
"Marks the field, argument, input field or enum value as deprecated"
directive @deprecated(
"The reason for the deprecation"
reason: String! = "No longer supported"
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION
"This directive disables error propagation when a non nullable field returns null for the given operation."
directive @experimental_disableErrorPropagation on QUERY | MUTATION | SUBSCRIPTION
"Directs the executor to include this field or fragment only when the `if` argument is true"
directive @include(
"Included when true."
if: Boolean!
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"Indicates an Input Object is a OneOf Input Object."
directive @oneOf on INPUT_OBJECT
"Directs the executor to skip this field or fragment when the `if` argument is true."
directive @skip(
"Skipped when true."
if: Boolean!
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"Exposes a URL that specifies the behaviour of this scalar."
directive @specifiedBy(
"The URL that specifies the behaviour of this scalar."
url: String!
) on SCALAR
type Query {
hello: String! @auth
}
'''
}
}