File tree Expand file tree Collapse file tree
src/test/groovy/graphql/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -298,6 +298,91 @@ enum Enum1 {
298298 EnumValue1
299299 EnumValue2
300300}
301+ """
302+ }
303+
304+ def " interface hierarchies" () {
305+ given :
306+ def schema = TestUtil . schema("""
307+ type Query {
308+ pets: Pet
309+ }
310+
311+ interface Pet {
312+ name: String
313+ }
314+ interface GoodPet implements Pet {
315+ name: String
316+ goodScore: Int
317+ }
318+ type Cat implements GoodPet & Pet{
319+ name: String
320+ goodScore: Int
321+ catField: ID
322+ }
323+
324+ interface ProblematicPet implements Pet {
325+ name: String
326+ problemField: Float
327+ }
328+ interface AnotherInterface implements ProblematicPet & Pet {
329+ name: String
330+ problemField: Float
331+ otherField: Boolean
332+ }
333+ type Dog implements AnotherInterface & ProblematicPet & Pet {
334+ name: String
335+ problemField: Float
336+ otherField: Boolean
337+ dogField: Int
338+ }
339+ """ )
340+
341+ when :
342+ def result = Anonymizer . anonymizeSchema(schema)
343+ def newSchema = new SchemaPrinter (SchemaPrinter.Options . defaultOptions(). includeDirectiveDefinitions(false )). print (result)
344+
345+ then :
346+ newSchema == """ schema {
347+ query: Object3
348+ }
349+
350+ interface Interface1 implements Interface2 {
351+ field1: String
352+ field2: Int
353+ }
354+
355+ interface Interface2 {
356+ field1: String
357+ }
358+
359+ interface Interface3 implements Interface2 {
360+ field1: String
361+ field4: Float
362+ }
363+
364+ interface Interface4 implements Interface2 & Interface3 {
365+ field1: String
366+ field4: Float
367+ field5: Boolean
368+ }
369+
370+ type Object1 implements Interface1 & Interface2 {
371+ field1: String
372+ field2: Int
373+ field3: ID
374+ }
375+
376+ type Object2 implements Interface2 & Interface3 & Interface4 {
377+ field1: String
378+ field4: Float
379+ field5: Boolean
380+ field6: Int
381+ }
382+
383+ type Object3 {
384+ field7: Interface2
385+ }
301386"""
302387 }
303388}
You can’t perform that action at this time.
0 commit comments