Skip to content

Commit f112054

Browse files
committed
deprecated default value method produces bad results
1 parent 0265179 commit f112054

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/groovy/graphql/schema/idl/SchemaPrinterTest.groovy

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,25 @@ type Query {
22472247
type TestObjectB {
22482248
field: String
22492249
}
2250+
'''
2251+
}
2252+
2253+
def "deprecated defaultValue on programmatic args prints as expected"() {
2254+
def queryObjType = newObject().name("Query")
2255+
.field(newFieldDefinition().name("f").type(GraphQLString)
2256+
.argument(newArgument().name("arg").type(GraphQLString).defaultValue(null)))
2257+
.build()
2258+
def schema = GraphQLSchema.newSchema().query(queryObjType).build()
2259+
2260+
2261+
when:
2262+
def options = defaultOptions().includeDirectiveDefinitions(false)
2263+
def sdl = new SchemaPrinter(options).print(schema)
2264+
then:
2265+
sdl == '''
2266+
type Query {
2267+
f(arg: String = null): String
2268+
}
22502269
'''
22512270
}
22522271
}

0 commit comments

Comments
 (0)