Skip to content

fix(10.x.x): custom union lookup on deprecated properties (#2178)#2186

Merged
samuelAndalon merged 1 commit into
ExpediaGroup:10.x.xfrom
Samjin:cherry-pick/10.0.1-fixes
Jun 18, 2026
Merged

fix(10.x.x): custom union lookup on deprecated properties (#2178)#2186
samuelAndalon merged 1 commit into
ExpediaGroup:10.x.xfrom
Samjin:cherry-pick/10.0.1-fixes

Conversation

@Samjin

@Samjin Samjin commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Cherry pick #2178 to v10.x.x branch.

@Samjin Samjin marked this pull request as ready for review June 18, 2026 00:55
@Samjin Samjin changed the title Cherry pick/10.0.1 fixes fix: custom union lookup on deprecated properties Jun 18, 2026
@Samjin Samjin enabled auto-merge (squash) June 18, 2026 01:03
@Samjin Samjin changed the title fix: custom union lookup on deprecated properties fix(10.x.x): custom union lookup on deprecated properties (#2178) Jun 18, 2026
@Samjin Samjin marked this pull request as draft June 18, 2026 16:15
auto-merge was automatically disabled June 18, 2026 16:15

Pull request was converted to draft

@Samjin Samjin marked this pull request as ready for review June 18, 2026 16:52
…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 Samjin force-pushed the cherry-pick/10.0.1-fixes branch from 9b19b1a to 33f81f0 Compare June 18, 2026 17:21
@samuelAndalon samuelAndalon merged commit 3d83250 into ExpediaGroup:10.x.x Jun 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants