Skip to content

Make generated JSON coding key Sendable#87

Open
kieran-osgood-shopify wants to merge 3 commits into
mainfrom
kieran-osgood/swift6/generated-model-sendable
Open

Make generated JSON coding key Sendable#87
kieran-osgood-shopify wants to merge 3 commits into
mainfrom
kieran-osgood/swift6/generated-model-sendable

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented May 13, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

  1. I needed to update the quick type generation so that the types for the JSON value, value, which is the JSON an any value property, does not use an any. it needs to code into a concrete type in order to be Swift 6 compatible so it can conform to sendable.
  2. attribution changes are due to stale snapshots (need to fix CI for this check)
    chore(protocol): refresh UCP snapshot (chore(protocol): refresh UCP snapshot #202) added attribution to the schema files without re-generating the files

How to test


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in platforms/swift/ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.66% (319/348) 87.86% (181/206) 100% (82/82)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 1b2c323 to a9cef3b Compare June 11, 2026 08:54
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 08574c6 to 92ab70f Compare June 11, 2026 08:54
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from a9cef3b to 0690561 Compare June 11, 2026 09:33
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 92ab70f to 01e34a8 Compare June 11, 2026 09:33
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 0690561 to 29a0e02 Compare June 11, 2026 10:01
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 01e34a8 to 65f806c Compare June 11, 2026 10:01
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 29a0e02 to 673bb39 Compare June 11, 2026 10:23
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch 2 times, most recently from 5678177 to 679b65c Compare June 11, 2026 10:32
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 673bb39 to 29722dd Compare June 11, 2026 10:32
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 679b65c to d8af537 Compare June 11, 2026 13:08
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 29722dd to 7c8db7f Compare June 11, 2026 13:08
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review June 11, 2026 14:31
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from d8af537 to 4f87743 Compare June 12, 2026 10:58
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/87 to kieran-osgood/swift6/synchronous-logger-state June 12, 2026 10:58
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 4f87743 to 7392cb4 Compare June 12, 2026 12:54
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from db98f08 to 157151b Compare June 12, 2026 12:54
Comment thread platforms/swift/.swiftformat Outdated
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 7392cb4 to e8efc29 Compare June 12, 2026 14:11
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 157151b to 488079a Compare June 12, 2026 14:11
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/swift6/synchronous-logger-state to graphite-base/87 June 12, 2026 15:22
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from e8efc29 to de91f40 Compare June 15, 2026 08:46
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/87 to kieran-osgood/swift6/synchronous-logger-state June 15, 2026 08:46
]);

await normalizeGeneratedFile(output);
await normalizeGeneratedFile(output, (source) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is a bit ugly, to avoid it silently failing in future I added a SHA check withQUICKTYPE_23_2_6_SWIFT_JSON_HELPER_SHA256 so we can detect change concretely in future. Ideally quicktype will provide better swift 6 support in future

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 88ac844 to 7000043 Compare June 15, 2026 13:17
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from de91f40 to 0fb8d20 Compare June 15, 2026 13:17
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch from 7000043 to 1168aca Compare June 15, 2026 13:34
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from 0fb8d20 to cc14713 Compare June 15, 2026 13:35
Comment thread protocol/scripts/generate_models.mjs Outdated
Comment on lines +359 to +371
return `${source.slice(0, helperStart)}// MARK: - Encode/decode helpers

public final class JSONNull: Codable, Hashable, Sendable {

public static func == (lhs: JSONNull, rhs: JSONNull) -> Bool {
return true
}

public func hash(into hasher: inout Hasher) {
hasher.combine(0)
}

public init() {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code living in a JS file feels brittle. Could this live as a .swift file that we can lint/format and read as a file here instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - I was being more accepting on the fact it exists in the generated models file so its all checked - but then its just duplicated unnecessarily

The script is updated now so that it replaces the code with a marker, and the code is actually just persistently stored in protocol/languages/swift/Sources/ShopifyCheckoutProtocol/JSONAny.swift

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/synchronous-logger-state branch 2 times, most recently from 831d87b to c89f450 Compare June 15, 2026 13:49
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from cc14713 to f5f36ff Compare June 15, 2026 13:49
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/swift6/synchronous-logger-state to graphite-base/87 June 15, 2026 14:06
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from f5f36ff to accb183 Compare June 15, 2026 14:06
@graphite-app graphite-app Bot changed the base branch from graphite-base/87 to main June 15, 2026 14:07
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch 2 times, most recently from 9054752 to fffc774 Compare June 15, 2026 14:10
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/generated-model-sendable branch from fffc774 to 1cb7220 Compare June 15, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants