Skip to content

Importing a framework with a generated client #767

Open
@adamkornafeld

Description

@adamkornafeld

Question

Great project, thanks for working on it!

I have a fairly large openapi spec (22k+ lines) that I use to generate a client with. The resulting Client.swift is 21k lines and Types.swift is 90k lines. Takes a good while to compile, like drink my coffee long. To avoid slowing down the compilation of projects that use the generated client, I created a framework (F) with the generated client that I distribute as a binary framework. I can import (F) into my app project (A).

The issue I am running into is that both generated swift files import OpenAPIRuntime on the very first line:

@_spi(Generated) import OpenAPIRuntime

Hence, I have to add OpenAPIRuntime as a dependency to my framework (F) project. So far so good, I will not add OpenAPIRuntime as a dependency to (A) to avoid the issue described below. However, I do have to add OpenAPIURLSession as a dependency to (A). That also depends on OpenAPIRuntime, so it pulls it in as a transitive dependency.

Net-net, when I run the app I see log messages:

objc[1426]: Class _TtC17OpenAPIURLSession40BidirectionalStreamingURLSessionDelegate is implemented in both 
/private/var/containers/Bundle/Application/02BB3430-E963-422B-9938-F07FFAB45EC4/A.app/Frameworks/F.framework/F (0x1032ed228) and 
/private/var/containers/Bundle/Application/02BB3430-E963-422B-9938-F07FFAB45EC4/A.app/A.debug.dylib (0x1039116d0). 
One of the two will be used. Which one is undefined.

The client and the app still works, it's mostly cosmetic that every time the app starts up, the console is flooded with tons of these messages. I have exhausted all my options to remedy this. Do you have any ideas how to resolve this? Thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportAdopter support requests.status/triageCollecting information required to triage the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions