swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

OpenAPI Generator doesn't support Windows

Open patricktcoakley opened this issue 10 months ago • 6 comments

Hey, I posted this in #151 but it probably makes sense as its own issue since it's tied to a specific dependency and is currently blocking me from trying to dig into getting Windows support. Just looking for some guidance to get started on this, thanks!

Hey, I'd be interested in trying to help with this effort when I have free cycles. Currently I am getting:

C:\Users\patri\Source\repos\swiftly\.build\checkouts\swift-openapi-generator\Sources\_OpenAPIGeneratorCore\PlatformChecks.swift:21:5: error: _OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly.
19 | #if !(os(macOS) || os(Linux) || (os(iOS) && targetEnvironment(macCatalyst)))

20 | #error(

21 |     "_OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly."

   |     `- error: _OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly.
22 | )

23 | #endif

coming from here, which implies that you might need to cross-compile for Windows or do some other workaround, and that it's not possible to develop on the platform natively.

Thanks!

Originally posted by @patricktcoakley in #151

patricktcoakley avatar Apr 02 '25 21:04 patricktcoakley

Thanks for bringing this up. It appears that the OpenAPI generator doesn't support Windows at all. Neither does Swift NIO at the moment. These will need to be figured out if there will be a swiftly Windows support.

cmcgee1024 avatar Apr 03 '25 20:04 cmcgee1024

It looks like this issue might at least unblock OpenAPI generator for some forward progress. I did take a look at NIO and there seems to been some progress going on as well. Would it make sense to create an issue for NIO separately? I plan to update this issue once I'm able to get past the current stage.

patricktcoakley avatar Apr 03 '25 23:04 patricktcoakley

I don't think that it can hurt to raise an issue on NIO. They might duplicate it if there's an existing one tracking Windows support.

cmcgee1024 avatar Apr 07 '25 12:04 cmcgee1024

This is the main tracking issue https://github.com/apple/swift-nio/issues/2065. FWIW NIO should get Windows support in the next few months

0xTim avatar Apr 07 '25 13:04 0xTim

This is the main tracking issue apple/swift-nio#2065. FWIW NIO should get Windows support in the next few months

That's great to hear! Is there somewhere that mentions this? The issue doesn't seem to have any recent activity to indicate that this is the case.

patricktcoakley avatar Apr 07 '25 13:04 patricktcoakley

It was mentioned here https://forums.swift.org/t/tcrun-managing-swift-toolchains-on-windows/77580/8

0xTim avatar Apr 07 '25 14:04 0xTim

Swift OpenAPI Generator supports Windows as of https://github.com/apple/swift-openapi-generator/releases/tag/1.7.2

czechboy0 avatar May 14 '25 07:05 czechboy0

Thanks for the update, @czechboy0!

Once I bumped the minimum versions of swift-openapi-generator and swift-openapi-runtime to 1.7.2 and 1.8.2, respectively, I'm able to hit NIO compilation errors, which is expected. I have created a small PR to bump these in order to support building on Windows going forward.

patricktcoakley avatar May 14 '25 14:05 patricktcoakley