Skip to content
Merged
Show file tree
Hide file tree
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
91 changes: 0 additions & 91 deletions src/main/java/graphql/GraphQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,97 +324,6 @@ public ExecutionResult execute(String query) {
return execute(executionInput);
}

/**
* Info: This sets context = root to be backwards compatible.
*
* @param query the query/mutation/subscription
* @param context custom object provided to each {@link graphql.schema.DataFetcher}
*
* @return an {@link ExecutionResult} which can include errors
*
* @deprecated Use {@link #execute(ExecutionInput)}
*/
@Deprecated
@DeprecatedAt("2017-06-02")
public ExecutionResult execute(String query, Object context) {
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
.query(query)
.context(context)
.root(context) // This we are doing do be backwards compatible
.build();
return execute(executionInput);
}

/**
* Info: This sets context = root to be backwards compatible.
*
* @param query the query/mutation/subscription
* @param operationName the name of the operation to execute
* @param context custom object provided to each {@link graphql.schema.DataFetcher}
*
* @return an {@link ExecutionResult} which can include errors
*
* @deprecated Use {@link #execute(ExecutionInput)}
*/
@Deprecated
@DeprecatedAt("2017-06-02")
public ExecutionResult execute(String query, String operationName, Object context) {
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
.query(query)
.operationName(operationName)
.context(context)
.root(context) // This we are doing do be backwards compatible
.build();
return execute(executionInput);
}

/**
* Info: This sets context = root to be backwards compatible.
*
* @param query the query/mutation/subscription
* @param context custom object provided to each {@link graphql.schema.DataFetcher}
* @param variables variable values uses as argument
*
* @return an {@link ExecutionResult} which can include errors
*
* @deprecated Use {@link #execute(ExecutionInput)}
*/
@Deprecated
@DeprecatedAt("2017-06-02")
public ExecutionResult execute(String query, Object context, Map<String, Object> variables) {
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
.query(query)
.context(context)
.root(context) // This we are doing do be backwards compatible
.variables(variables)
.build();
return execute(executionInput);
}

/**
* Info: This sets context = root to be backwards compatible.
*
* @param query the query/mutation/subscription
* @param operationName name of the operation to execute
* @param context custom object provided to each {@link graphql.schema.DataFetcher}
* @param variables variable values uses as argument
*
* @return an {@link ExecutionResult} which can include errors
*
* @deprecated Use {@link #execute(ExecutionInput)}
*/
@Deprecated
@DeprecatedAt("2017-06-02")
public ExecutionResult execute(String query, String operationName, Object context, Map<String, Object> variables) {
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
.query(query)
.operationName(operationName)
.context(context)
.root(context) // This we are doing do be backwards compatible
.variables(variables)
.build();
return execute(executionInput);
}

/**
* Executes the graphql query using the provided input object builder
Expand Down
6 changes: 4 additions & 2 deletions src/test/groovy/graphql/MutationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class MutationTest extends Specification {
]

when:
def executionResult = GraphQL.newGraphQL(MutationSchema.schema).build().execute(query, new MutationSchema.SubscriptionRoot(6))
def ei = ExecutionInput.newExecutionInput(query).root(new MutationSchema.SubscriptionRoot(6)).build()
def executionResult = GraphQL.newGraphQL(MutationSchema.schema).build().execute(ei)


then:
Expand Down Expand Up @@ -93,7 +94,8 @@ class MutationTest extends Specification {
]

when:
def executionResult = GraphQL.newGraphQL(MutationSchema.schema).build().execute(query, new MutationSchema.SubscriptionRoot(6))
def ei = ExecutionInput.newExecutionInput(query).root(new MutationSchema.SubscriptionRoot(6)).build()
def executionResult = GraphQL.newGraphQL(MutationSchema.schema).build().execute(ei)


then:
Expand Down
6 changes: 4 additions & 2 deletions src/test/groovy/graphql/StarWarsQueryTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ class StarWarsQueryTest extends Specification {
]
]
when:
def result = GraphQL.newGraphQL(StarWarsSchema.starWarsSchema).build().execute(query, null, params).data
def ei = ExecutionInput.newExecutionInput(query).variables(params).build()
def result = GraphQL.newGraphQL(StarWarsSchema.starWarsSchema).build().execute(ei).data

then:
result == expected
Expand All @@ -212,7 +213,8 @@ class StarWarsQueryTest extends Specification {
human: null
]
when:
def result = GraphQL.newGraphQL(StarWarsSchema.starWarsSchema).build().execute(query, null, params).data
def ei = ExecutionInput.newExecutionInput(query).variables(params).build()
def result = GraphQL.newGraphQL(StarWarsSchema.starWarsSchema).build().execute(ei).data

then:
result == expected
Expand Down
6 changes: 4 additions & 2 deletions src/test/groovy/graphql/UnionTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class UnionTest extends Specification {
]

when:
def executionResult = GraphQL.newGraphQL(GarfieldSchema.GarfieldSchema).build().execute(query, GarfieldSchema.john)
def ei = ExecutionInput.newExecutionInput(query).root(GarfieldSchema.john).build()
def executionResult = GraphQL.newGraphQL(GarfieldSchema.GarfieldSchema).build().execute(ei)

then:
executionResult.data == expectedResult
Expand Down Expand Up @@ -148,7 +149,8 @@ class UnionTest extends Specification {
]
]
when:
def executionResult = GraphQL.newGraphQL(GarfieldSchema.GarfieldSchema).build().execute(query, GarfieldSchema.john)
def ei = ExecutionInput.newExecutionInput(query).root(GarfieldSchema.john).build()
def executionResult = GraphQL.newGraphQL(GarfieldSchema.GarfieldSchema).build().execute(ei)

then:
executionResult.data == expectedResult
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package graphql.normalized

import graphql.ExecutionInput
import graphql.GraphQL
import graphql.TestUtil
import graphql.execution.CoercedVariables
Expand Down Expand Up @@ -1314,7 +1315,8 @@ schema {

private void assertValidQuery(GraphQLSchema graphQLSchema, String query, Map variables = [:]) {
GraphQL graphQL = GraphQL.newGraphQL(graphQLSchema).build()
assert graphQL.execute(query, null, variables).errors.size() == 0
def ei = ExecutionInput.newExecutionInput(query).variables(variables).build()
assert graphQL.execute(ei).errors.size() == 0
}

def "normalized arguments"() {
Expand Down