Skip to content

Commit

Permalink
Merge pull request #3360 from graphql-java/revert-2741-2740-parse_and…
Browse files Browse the repository at this point in the history
…_validate-catch_operation_to_schema_mismatch

Revert "A test to show that validation rules do not catch a mutation query to schema mismatch"
  • Loading branch information
dondonz committed Oct 24, 2023
2 parents ab23957 + 3f03bd1 commit 42efd9b
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/test/groovy/graphql/ParseAndValidateTest.groovy
@@ -1,12 +1,6 @@
package graphql

import graphql.language.Document
import graphql.parser.InvalidSyntaxException
import graphql.parser.Parser
import graphql.schema.GraphQLSchema
import graphql.schema.idl.SchemaParser
import graphql.schema.idl.TypeDefinitionRegistry
import graphql.schema.idl.UnExecutableSchemaGenerator
import graphql.validation.ValidationError
import graphql.validation.ValidationErrorType
import graphql.validation.rules.NoUnusedFragments
Expand Down Expand Up @@ -161,30 +155,4 @@ class ParseAndValidateTest extends Specification {
then:
!rs.errors.isEmpty() // all rules apply - we have errors
}

def "issue 2740 - evidence of not working"() {
def sdl = '''
type Query {
myquery : String!
}
'''

def registry = new SchemaParser().parse(sdl)
def schema = UnExecutableSchemaGenerator.makeUnExecutableSchema(registry)
def graphQL = GraphQL.newGraphQL(schema).build()

String request = "mutation MyMutation { mymutation }"

when:
def er = graphQL.execute(request)
then:
er.errors.size() == 1

when:
Document inputDocument = new Parser().parseDocument(request)
List<ValidationError> errors = ParseAndValidate.validate(schema, inputDocument)

then:
errors.size() == 1
}
}

0 comments on commit 42efd9b

Please sign in to comment.