fix(schema-generator): custom union lookup on deprecated properties#2178
Merged
samuelAndalon merged 2 commits intoJun 16, 2026
Merged
Conversation
samuelAndalon
approved these changes
Jun 16, 2026
This was referenced Jun 17, 2026
samuelAndalon
pushed a commit
that referenced
this pull request
Jun 17, 2026
Back port #2178 to v6 Coverage always run before integration and cause constant failing in PR check. 7+ version doesn't have such issue. --------- Co-authored-by: sjin <sjin@expediagroup.com>
This was referenced Jun 18, 2026
Samjin
pushed a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
Samjin
pushed a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
Samjin
pushed a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
Samjin
pushed a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
Samjin
pushed a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
Samjin
added a commit
to Samjin/graphql-kotlin
that referenced
this pull request
Jun 18, 2026
…xpediaGroup#2178) ## Problem Custom union annotations can be missed when they are used on a property that also has another annotation, such as @deprecated. This leads to a failing build job and user can't deprecate the union below. ```kotlin @GraphQLUnion( name = "ToolbarAction", possibleTypes = [IconButton::class, TextButton::class] ) annotation class ToolbarAction data class Sheet( @deprecated("Use toolbar instead") @ToolbarAction val actions: List<Any> ) ``` The current ```kotlin annotations .map { it.getMetaUnionAnnotation() } .firstOrNull() ``` returns `null` as result and missing the ToolbarAction and fail build job. ## Approach Skip annotations that do not contain a meta-union and use the first actual match. This keeps the existing behavior for direct @GraphQLUnion annotations and for fields without custom unions, while allowing deprecated custom-union properties to generate the expected union field and preserve the deprecation reason. --------- Co-authored-by: sjin <sjin@expediagroup.com>
Samjin
added a commit
that referenced
this pull request
Jun 18, 2026
Samjin
added a commit
that referenced
this pull request
Jun 18, 2026
Samjin
added a commit
that referenced
this pull request
Jun 18, 2026
samuelAndalon
pushed a commit
that referenced
this pull request
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Custom union annotations can be missed when they are used on a property that also has another annotation, such as @deprecated. This leads to a failing build job and user can't deprecate the union below.
@GraphQLUnion( name = "ToolbarAction", possibleTypes = [IconButton::class, TextButton::class] ) annotation class ToolbarAction data class Sheet( @Deprecated("Use toolbar instead") @ToolbarAction val actions: List<Any> )The current
annotations .map { it.getMetaUnionAnnotation() } .firstOrNull()returns
nullas result and missing the ToolbarAction and fail build job.Approach
Skip annotations that do not contain a meta-union and use the first actual match.
This keeps the existing behavior for direct @GraphQLUnion annotations and for fields without custom unions, while allowing deprecated custom-union properties to generate the expected union field and preserve the deprecation reason.