Description
I want to suggest an idea and checked that ...
- ... to my best knowledge, my idea wouldn't break something for other users
- ... the documentation does not mention anything about my idea
- ... there are no open or closed issues that are related to my idea
Description
According to the June 2018 GraphQL spec, the following types may be extended in a GraphQL schema:
- Scalars
- Objects (type in SDL)
- Interfaces
- Unions
- Enums
- InputObjects (input in SDL)
The kotlin.graphql.kickstart.tools.SchemaParser.kt class currently supports extensions of Objects and InputObjects but it does not support extensions for Scalars, Unions, Enums, or Interfaces. The result is that extensions of these types are not respected when constructing the corresponding GraphQLTypes.
This new feature could be modeled after the existing behavior in the SchemaParser that currently separates ObjectTypeExtensionDefinitions and InputObjectTypeExtensionDefinitions.
Add logic to SchemaParser to treat ScalarTypeExtensionDefinitions, UnionTypeExtensionDefinitions, EnumTypeExtensionDefinitions, and InterfaceTypeExtensionDefinitions similar to ObjectTypeExtensionDefinitions and InputObjectTypeExtensions.
Use Cases
Support extending Scalar, Union, Enum, and Interfaces types throughout a schema.
Note: This opportunity for enhancement was discovered while attempting to extend a union type. I have not confirmed the behavior for Scalar, Enum, or Interface types but have included those types in this issue based on code inspection of the SchemaParser class.
Consider the following SDL:
union FooBar = Foo | Bar
extend union FooBar = Baz
The expectation is that FooBar would resolve to Foo | Bar | Baz. However, under the current implementation it resolves to Baz.