Skip to content

Prototype: wrap MediaType in a UniFFI object to prevent fallback variant breakage#1364

Draft
oguzkocer wants to merge 1 commit into
trunkfrom
prototype/enum-wrapper-fallback
Draft

Prototype: wrap MediaType in a UniFFI object to prevent fallback variant breakage#1364
oguzkocer wants to merge 1 commit into
trunkfrom
prototype/enum-wrapper-fallback

Conversation

@oguzkocer
Copy link
Copy Markdown
Contributor

When a new named variant is added to an enum with a fallback (e.g. Custom(String)), Kotlin/Swift code checking is CustomException silently stops matching. This wraps MediaType in a MediaTypeWrapper UniFFI object so clients must use isMediaType() for comparison, which normalizes through the string representation and is resilient to variant promotion.

…riant breakage

When a new named variant is added to an enum with a fallback (e.g.
`Custom(String)`), Kotlin/Swift code checking `is CustomException`
silently stops matching. This wraps `MediaType` in a `MediaTypeWrapper`
UniFFI object so clients must use `isMediaType()` for comparison,
which normalizes through the string representation and is resilient
to variant promotion.
@wpmobilebot
Copy link
Copy Markdown
Collaborator

⚠️ CHANGELOG.md was not updated in this PR.

Every PR should add an entry under the ## [Unreleased] section of CHANGELOG.md describing the change for our users. The format follows Keep a Changelog 1.0.0 — use one of:

  • ### Added — for new features
  • ### Changed — for changes in existing functionality (prefix **BREAKING:** if breaking)
  • ### Deprecated — for soon-to-be-removed features
  • ### Removed — for now-removed features
  • ### Fixed — for any bug fixes
  • ### Security — for vulnerability fixes

If the change genuinely has no user-visible impact (e.g. CI-only tweaks, internal refactors), add a short entry under ### Changed noting that.

@wpmobilebot
Copy link
Copy Markdown
Collaborator

XCFramework Build

This PR's XCFramework is available for testing. Add to your Package.swift:

.package(url: "https://github.com/automattic/wordpress-rs", branch: "pr-build/1364")

Built from 8ef9173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants