Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/test/groovy/graphql/Issue296.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package graphql

import spock.lang.Specification

import static graphql.Scalars.GraphQLString
import static graphql.schema.GraphQLArgument.newArgument
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition
import static graphql.schema.GraphQLInputObjectField.newInputObjectField
import static graphql.schema.GraphQLInputObjectType.newInputObject
import static graphql.schema.GraphQLObjectType.newObject
import static graphql.schema.GraphQLSchema.newSchema

class Issue296 extends Specification {

def "test"() {

def graphql = GraphQL.newGraphQL(newSchema()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TestUtil.schemaWithInputType(inputType)

.query(newObject()
.name("Query")
.field(newFieldDefinition()
.name("field")
.type(GraphQLString)
.argument(newArgument()
.name("argument")
.type(newInputObject()
.name("InputObjectType")
.field(newInputObjectField()
.name("inputField")
.type(GraphQLString))
.build())
.defaultValue([field1:'value1']))))
.build())
.build()

def query = '{ __type(name: "Query") { fields { args { defaultValue } } } }'

// Instead of `'{field: "value"}'` you get '{field1=value1}' (#toString())
expect:
graphql.execute(query).data == [ __type: [ fields: [ [ args: [ [ defaultValue: '{field: "value"}' ] ] ] ] ] ]
}
}