Backport GraphQLUnion to 4.x.x #1234
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description
Since the schema can be generated from code you can use existing Kotlin classes from common libraries to define shared models. However if you want to declare an object defined in the library as implementing some new interface or union in your service it is not possible, since we can't modify the class definition to add Kotlin code to it.
These changes would allow us to use
Any
as the return type in the schema but then, through annotations, modify the schema return type to match the new class we want to use.For example in an SDL-First world you could have this Kotlin class defined in some library
And then write your schema as the following
But this is not currently possible in the full code-generation approach
🔗 Related Issues
PR into master branch: #1194