You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reject enum values, interface fields and union members that a type declares twice in 15.0.0 #863
Since #855, extensions are merged into the type they extend. When a type ends up declaring an enum value, interface field or union member twice, e.g. in the type and again in an extension, tools keeps the first one and logs a warning:
enumColor { RED }
extendenumColor { RED GREEN }
Type 'Color' declares value 'RED' more than once, only the first one is kept.
graphql-java's SchemaGenerator rejects these schemas, and the spec doesn't allow an extension to redeclare what the type already has. But they built before #855, since the extension used to replace the type, so failing on them has to wait for a major release.
Keeping the first one hides mistakes though. interface Node { id: ID } plus extend interface Node { id: String } builds with id: ID, and only a log line says the extension's id was dropped.
What to change
replace the warning in SchemaParser#warnRepeated with a SchemaError that names the type and the repeated value, field or member
drop the distinctBy { it.name } on the enum values in createEnumObject and the interface fields in createInterfaceObject
move the repeats out of TypeExtensionTest.repeats and extensions without a type keep building into a test for the error
Activity