File tree Expand file tree Collapse file tree
main/java/graphql/schema/idl
test/groovy/graphql/schema/idl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -672,7 +672,7 @@ private SchemaElementPrinter<GraphQLInputObjectType> inputObjectPrinter() {
672672 String astValue = printAst (defaultValue , fd .getType ());
673673 out .format (" = %s" , astValue );
674674 }
675- out .format (directivesString (GraphQLInputObjectField .class , fd .isDeprecated (), fd ));
675+ out .print (directivesString (GraphQLInputObjectField .class , fd .isDeprecated (), fd ));
676676 out .format ("\n " );
677677 });
678678 out .format ("}" );
Original file line number Diff line number Diff line change @@ -2012,6 +2012,28 @@ type Query {
20122012'''
20132013 }
20142014
2015+ def " directive containing formatting specifiers" () {
2016+ def constraintDirective = GraphQLDirective . newDirective(). name(" constraint" )
2017+ .argument({
2018+ it. name(" regex" ). type(GraphQLString ). valueProgrammatic(" %" )
2019+ })
2020+ .build()
2021+ GraphQLInputObjectType type = GraphQLInputObjectType . newInputObject(). name(" Person" )
2022+ .field({ it. name(" thisMustBeAPercentageSign" ). type(GraphQLString ). withDirective(constraintDirective) })
2023+ .build()
2024+
2025+ when :
2026+
2027+ def result = new SchemaPrinter (). print (type)
2028+
2029+
2030+ then :
2031+ result == ''' input Person {
2032+ thisMustBeAPercentageSign: String @constraint(regex : "%")
2033+ }
2034+ '''
2035+ }
2036+
20152037 def " can specify a new ordering for the schema printer" () {
20162038
20172039 def sdl = """
You can’t perform that action at this time.
0 commit comments