-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make OpenAPIRuntime depend on FoundationEssentials only #732
Comments
We'll need to import conditionally, as FoundationEssentials isn't available on all platforms. The mechanism for doing this without breaking API will likely be to add a default trait with the "full Foundation" imports, allowing adopters to turn off default traits and only get the code that requires FoundationEssentials. That'll require Swift 6.1. |
You should just write
Of course this will only work iff you haven't actually used any legacy Foundation types in your API. |
Yeah that's the idea, but we can't do it without traits, otherwise it's a breaking change: apple/swift-metrics#158 (comment) |
Whilst it's true that this is observable by others in theory, I don't think it applies to Furthermore, OpenAPI also has the transports, both of AHC / URLSession also I really don't think it's worth using traits for this theoretical breakage. I doubt there is any real world code that relies on |
OpenAPIRuntime is not SwiftMetrics. Almost everywhere also If you really feel you can't do that (which is think is just making your own life hard), the way to solve it is
That prevents bugs and accidental legacy usage whilst keeping existing behaviours. |
The above is my proposed plan for swift-asn1 and swift-certificates, incidentally, which I expect to do in the next couple of weeks. |
Motivation
FoundationEssentials contains only the more modern types and comes in (on non-Darwin) much more lightweight than
Foundation
which also includes a lot of legacy stuff from swift-corelibs-foundation.Ideally, the OpenAPIRuntime should be happy with just FoundationEssentials which contains everything that I think it needs (JSON, Date, URL, Data, ...).
Proposed solution
Replace all
import Foundation
s withimport FoundationEssentials
.Alternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: