Skip to content

Commit 62bac40

Browse files
authored
Merge pull request #437 from dh94/425-add-lincol
425 add lincol
2 parents 5d2571f + ccecbef commit 62bac40

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

src/main/java/graphql/schema/idl/errors/NotAnInputTypeError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
public class NotAnInputTypeError extends BaseError {
88

99
public NotAnInputTypeError(TypeDefinition typeDefinition) {
10-
super(typeDefinition, format("expected InputType, but found %s type", typeDefinition.getName()));
10+
super(typeDefinition, format("expected InputType, but found %s type %s", typeDefinition.getName(), lineCol(typeDefinition)));
1111
}
1212
}

src/main/java/graphql/schema/idl/errors/NotAnOutputTypeError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
public class NotAnOutputTypeError extends BaseError {
88

99
public NotAnOutputTypeError(TypeDefinition typeDefinition) {
10-
super(typeDefinition, format("expected OutputType, but found %s type", typeDefinition.getName()));
10+
super(typeDefinition, format("expected OutputType, but found %s type %s", typeDefinition.getName(), lineCol(typeDefinition)));
1111
}
1212
}

src/test/groovy/graphql/schema/idl/SchemaGeneratorTest.groovy

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ class SchemaGeneratorTest extends Specification {
208208
"""
209209

210210
def schemaSpec3 = """
211-
212211
# the schema allows the following query
213212
# to be made
214213
type Query {
@@ -259,7 +258,6 @@ class SchemaGeneratorTest extends Specification {
259258

260259
def "union type: union member used two times "() {
261260
def spec = """
262-
263261
type Query {
264262
foobar: FooOrBar
265263
foo: Foo
@@ -278,7 +276,6 @@ class SchemaGeneratorTest extends Specification {
278276
schema {
279277
query: Query
280278
}
281-
282279
"""
283280

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

300297
def "union type: union members only used once"() {
301298
def spec = """
302-
303299
type Query {
304300
foobar: FooOrBar
305301
}
@@ -317,7 +313,6 @@ class SchemaGeneratorTest extends Specification {
317313
schema {
318314
query: Query
319315
}
320-
321316
"""
322317

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

339334
def "union type: union declared before members"() {
340335
def spec = """
341-
342336
union FooOrBar = Foo | Bar
343337
344338
type Foo {
@@ -356,7 +350,6 @@ class SchemaGeneratorTest extends Specification {
356350
schema {
357351
query: Query
358352
}
359-
360353
"""
361354

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

380373
def spec = """
381-
382374
enum RGB {
383375
RED
384376
GREEN
@@ -392,7 +384,6 @@ class SchemaGeneratorTest extends Specification {
392384
schema {
393385
query: Query
394386
}
395-
396387
"""
397388

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

412403
def spec = """
413-
414404
interface Foo {
415405
is_foo : Boolean
416406
}
@@ -427,7 +417,6 @@ class SchemaGeneratorTest extends Specification {
427417
schema {
428418
query: Query
429419
}
430-
431420
"""
432421

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

452441
def spec = """
453-
454442
interface Interface1 {
455443
extraField1 : String
456444
}
457-
458445
interface Interface2 {
459446
extraField1 : String
460447
extraField2 : Int
461448
}
462-
463449
interface Interface3 {
464450
extraField1 : String
465451
extraField3 : ID
466452
}
467-
468453
type BaseType {
469454
baseField : String
470455
}
471456
472457
extend type BaseType implements Interface1 {
473458
extraField1 : String
474459
}
475-
476460
extend type BaseType implements Interface2 {
477461
extraField1 : String
478462
extraField2 : Int
479463
}
480-
481464
extend type BaseType implements Interface3 {
482465
extraField1 : String
483466
extraField3 : ID
484467
}
485-
486468
extend type BaseType {
487469
extraField4 : Boolean
488470
}
489-
490471
extend type BaseType {
491472
extraField5 : Boolean!
492473
}
493-
494474
#
495475
# if we repeat a definition, that's ok as long as its the same types as before
496476
# they will be de-duped since the effect is the same
@@ -502,7 +482,6 @@ class SchemaGeneratorTest extends Specification {
502482
schema {
503483
query: BaseType
504484
}
505-
506485
"""
507486

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

551530
def spec = """
552-
553531
schema {
554532
query: Human
555533
}
556-
557534
type Episode {
558535
name : String
559536
}
@@ -566,12 +543,10 @@ class SchemaGeneratorTest extends Specification {
566543
id: ID!
567544
name: String!
568545
}
569-
570546
extend type Human implements Character {
571547
name: String!
572548
friends: [Character]
573549
}
574-
575550
extend type Human {
576551
appearsIn: [Episode]!
577552
homePlanet: String
@@ -624,7 +599,7 @@ class SchemaGeneratorTest extends Specification {
624599

625600
then:
626601
def err = thrown(NotAnInputTypeError.class)
627-
err.message == "expected InputType, but found CharacterInput type"
602+
err.message == "expected InputType, but found CharacterInput type [@11:13]"
628603
}
629604

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

653628
then:
654629
def err = thrown(NotAnOutputTypeError.class)
655-
err.message == "expected OutputType, but found CharacterInput type"
630+
err.message == "expected OutputType, but found CharacterInput type [@11:13]"
656631
}
657632

658633
def "schema with subscription"() {
@@ -677,4 +652,4 @@ class SchemaGeneratorTest extends Specification {
677652
then:
678653
schema.getSubscriptionType().name == "Subscription"
679654
}
680-
}
655+
}

0 commit comments

Comments
 (0)