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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
public class NotAnInputTypeError extends BaseError {

public NotAnInputTypeError(TypeDefinition typeDefinition) {
super(typeDefinition, format("expected InputType, but found %s type", typeDefinition.getName()));
super(typeDefinition, format("expected InputType, but found %s type %s", typeDefinition.getName(), lineCol(typeDefinition)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
public class NotAnOutputTypeError extends BaseError {

public NotAnOutputTypeError(TypeDefinition typeDefinition) {
super(typeDefinition, format("expected OutputType, but found %s type", typeDefinition.getName()));
super(typeDefinition, format("expected OutputType, but found %s type %s", typeDefinition.getName(), lineCol(typeDefinition)));
}
}
31 changes: 3 additions & 28 deletions src/test/groovy/graphql/schema/idl/SchemaGeneratorTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ class SchemaGeneratorTest extends Specification {
"""

def schemaSpec3 = """

# the schema allows the following query
# to be made
type Query {
Expand Down Expand Up @@ -259,7 +258,6 @@ class SchemaGeneratorTest extends Specification {

def "union type: union member used two times "() {
def spec = """

type Query {
foobar: FooOrBar
foo: Foo
Expand All @@ -278,7 +276,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: Query
}

"""

def schema = generateSchema(spec, RuntimeWiring.newRuntimeWiring()
Expand All @@ -299,7 +296,6 @@ class SchemaGeneratorTest extends Specification {

def "union type: union members only used once"() {
def spec = """

type Query {
foobar: FooOrBar
}
Expand All @@ -317,7 +313,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: Query
}

"""

def schema = generateSchema(spec, RuntimeWiring.newRuntimeWiring()
Expand All @@ -338,7 +333,6 @@ class SchemaGeneratorTest extends Specification {

def "union type: union declared before members"() {
def spec = """

union FooOrBar = Foo | Bar

type Foo {
Expand All @@ -356,7 +350,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: Query
}

"""

def schema = generateSchema(spec, RuntimeWiring.newRuntimeWiring()
Expand All @@ -378,7 +371,6 @@ class SchemaGeneratorTest extends Specification {
def "enum types are handled"() {

def spec = """

enum RGB {
RED
GREEN
Expand All @@ -392,7 +384,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: Query
}

"""

def schema = generateSchema(spec, RuntimeWiring.newRuntimeWiring().build())
Expand All @@ -410,7 +401,6 @@ class SchemaGeneratorTest extends Specification {
def "interface types are handled"() {

def spec = """

interface Foo {
is_foo : Boolean
}
Expand All @@ -427,7 +417,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: Query
}

"""

def wiring = RuntimeWiring.newRuntimeWiring()
Expand All @@ -450,47 +439,38 @@ class SchemaGeneratorTest extends Specification {
def "type extensions can be specified multiple times #406"() {

def spec = """

interface Interface1 {
extraField1 : String
}

interface Interface2 {
extraField1 : String
extraField2 : Int
}

interface Interface3 {
extraField1 : String
extraField3 : ID
}

type BaseType {
baseField : String
}

extend type BaseType implements Interface1 {
extraField1 : String
}

extend type BaseType implements Interface2 {
extraField1 : String
extraField2 : Int
}

extend type BaseType implements Interface3 {
extraField1 : String
extraField3 : ID
}

extend type BaseType {
extraField4 : Boolean
}

extend type BaseType {
extraField5 : Boolean!
}

#
# if we repeat a definition, that's ok as long as its the same types as before
# they will be de-duped since the effect is the same
Expand All @@ -502,7 +482,6 @@ class SchemaGeneratorTest extends Specification {
schema {
query: BaseType
}

"""

def wiring = RuntimeWiring.newRuntimeWiring()
Expand Down Expand Up @@ -549,11 +528,9 @@ class SchemaGeneratorTest extends Specification {
def "read me type example makes sense"() {

def spec = """

schema {
query: Human
}

type Episode {
name : String
}
Expand All @@ -566,12 +543,10 @@ class SchemaGeneratorTest extends Specification {
id: ID!
name: String!
}

extend type Human implements Character {
name: String!
friends: [Character]
}

extend type Human {
appearsIn: [Episode]!
homePlanet: String
Expand Down Expand Up @@ -624,7 +599,7 @@ class SchemaGeneratorTest extends Specification {

then:
def err = thrown(NotAnInputTypeError.class)
err.message == "expected InputType, but found CharacterInput type"
err.message == "expected InputType, but found CharacterInput type [@11:13]"
}

def "InputType used as type should throw appropriate error #425"() {
Expand Down Expand Up @@ -652,7 +627,7 @@ class SchemaGeneratorTest extends Specification {

then:
def err = thrown(NotAnOutputTypeError.class)
err.message == "expected OutputType, but found CharacterInput type"
err.message == "expected OutputType, but found CharacterInput type [@11:13]"
}

def "schema with subscription"() {
Expand All @@ -677,4 +652,4 @@ class SchemaGeneratorTest extends Specification {
then:
schema.getSubscriptionType().name == "Subscription"
}
}
}