Closed lilidotshi closed 1 week ago
Hi, this should be fixed, by those two PR https://github.com/OpenAPITools/openapi-generator/pull/20013 https://github.com/OpenAPITools/openapi-generator/pull/20023, in the swift 6 generator when the openapi-generator 7.10.0 is released. Until then, you can build openapi-generator from source, which will create a jar, and use the jar directly. https://github.com/OpenAPITools/openapi-generator?tab=readme-ov-file#14---build-projects
Hi, this should be fixed, by those two PR #20013 #20023, in the swift 6 generator when the openapi-generator 7.10.0 is released. Until then, you can build openapi-generator from source, which will create a jar, and use the jar directly. https://github.com/OpenAPITools/openapi-generator?tab=readme-ov-file#14---build-projects
Ah thank you!
Bug Report Checklist
Description
With Swift 6, there's more strict concurrency checks, including sendable objects being sent across actor boundaries. This is a fairly basic view model for async calls that feed up to a SwiftUI View.
The OpenAPI generated model looks something like this:
In Swift 5,
let response = await FooAPI.fetchTitle()
generates an warningNon-sendable type 'TitleResponse' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary; this is an error in the Swift 6 language mode
Since the structs generated by OpenAPI are public structs, they don't get the implicit conformance to
Sendable
, which leaves us with that error. I am curious what your recommendation is moving forward for Swift 6, if the objects should conform by default to Sendable or not.openapi-generator version
7.9.0