Describe the bug
On Swift 6, in a macOS 26.2 project, the first example from the README produces the build error:
Conformance of 'Person' to protocol 'ResourceDefinitionProviding' crosses into main actor-isolated code and can cause data races
- In expansion of macro 'ResourceWrapper' on struct 'Person' here
- Conformance depends on main actor-isolated conformance of 'Person.Definition' to protocol 'ResourceDefinition'
- Isolate this conformance to the main actor with '@ MainActor'
Checklist
Steps to reproduce
Explanation of how to reproduce the incorrect behavior. This could include an attached project, a link to code, or a JSON:API document exhibiting the issue.
- Clone https://github.com/kgutwin/jsonapiTest
- Run
xcodebuild -project jsonapiTest.xcodeproj -scheme jsonapiTest -sdk macosx build -skipMacroValidation (or just build within Xcode)
Observed
SwiftCompile normal arm64 /Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift (in target 'jsonapiTest' from project 'jsonapiTest')
cd /Users/kgutwin/xcode/jsonapiTest
@__swiftmacro_11jsonapiTest6Person15ResourceWrapperfMe_.swift:1:27: error: conformance of 'Person' to protocol 'ResourceDefinitionProviding' crosses into main actor-isolated code and can cause data races
extension Person: JSONAPI.ResourceDefinitionProviding {
^
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@__swiftmacro_11jsonapiTest6Person15ResourceWrapperfMe_.swift:1:27: note: isolate this conformance to the main actor with '@MainActor'
extension Person: JSONAPI.ResourceDefinitionProviding {
^
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@__swiftmacro_11jsonapiTest6Person15ResourceWrapperfMe_.swift:1:1: note: conformance depends on main actor-isolated conformance of 'Person.Definition' to protocol 'ResourceDefinition'
extension Person: JSONAPI.ResourceDefinitionProviding {
^
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift:11:1: note: in expansion of macro 'ResourceWrapper' on struct 'Person' here
@ResourceWrapper(type: "people")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SwiftDriverJobDiscovery normal arm64 Compiling GeneratedAssetSymbols.swift (in target 'jsonapiTest' from project 'jsonapiTest')
SwiftDriverJobDiscovery normal arm64 Compiling ContentView.swift (in target 'jsonapiTest' from project 'jsonapiTest')
SwiftCompile normal arm64 Compiling\ jsonapiTestApp.swift /Users/kgutwin/xcode/jsonapiTest/jsonapiTest/jsonapiTestApp.swift (in target 'jsonapiTest' from project 'jsonapiTest')
** BUILD FAILED **
The following build commands failed:
SwiftCompile normal arm64 Compiling\ ApiModels.swift /Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift (in target 'jsonapiTest' from project 'jsonapiTest')
SwiftCompile normal arm64 /Users/kgutwin/xcode/jsonapiTest/jsonapiTest/ApiModels.swift (in target 'jsonapiTest' from project 'jsonapiTest')
Building project jsonapiTest with scheme jsonapiTest
(3 failures)
Expected behavior
The example code should compile as-is with no errors.
Version information
- JSONAPI: 0.1.5
- OS: macOS 26.5.1 (Tahoe)
- Xcode: 26.2
Additional context
The reproduction repository uses the dependency from the fork https://github.com/bioteam/swift-jsonapi because my cursed Xcode configuration for some reason requires .git suffixes attached to the URLs defined in the Package.swift dependencies. I'm not expecting this has anything to do with the reported error.
Describe the bug
On Swift 6, in a macOS 26.2 project, the first example from the README produces the build error:
Checklist
mainbranch of this package.Steps to reproduce
Explanation of how to reproduce the incorrect behavior. This could include an attached project, a link to code, or a JSON:API document exhibiting the issue.
xcodebuild -project jsonapiTest.xcodeproj -scheme jsonapiTest -sdk macosx build -skipMacroValidation(or just build within Xcode)Observed
Expected behavior
The example code should compile as-is with no errors.
Version information
Additional context
The reproduction repository uses the dependency from the fork https://github.com/bioteam/swift-jsonapi because my cursed Xcode configuration for some reason requires
.gitsuffixes attached to the URLs defined in thePackage.swiftdependencies. I'm not expecting this has anything to do with the reported error.