SwagGen
SwagGen copied to clipboard
Swift template: remove Alamofire?
Once #32 is complete, it will remove the JSONUtilities dependency. Is it worth removing the Alamofire dependency as well, which would make the generated code dependency free.
Would anyone miss the Alamofire integration? Is anyone hooking into it, or just using the plain ApiClient?
I would prefer to remove Alamofire. I've done this in a fork by using a delegate protocol which allows the app to implement request logic how it sees fit. Not sure if that makes sense for this project or not.
I use some fancy Alamofire features, such as tls certificate pinning, Timeline (connection latency) and retry strategies in poor connection circumstances, so I'd prefer to stick with Alamofire...
The Result dependency has been removed here https://github.com/yonaskolb/SwagGen/pull/174
It would be nice if you could generate only models and endpoints without any concrete implementation. The meaty part of swagger codegen is endpoints and models, everyone already knows how to write network clients.
And, if you already have your networking written, and want to migrate to Swagger, it would be much easier to use your existing client with the generated endpoints, rather than have two separate clients doing their own thing.
So, I prepared this: https://gist.github.com/szotp/0498e7adb7e093b8600425c4baabb888 where amount of generated code is as small as possible. People would have to write their own clients to use this, or presumably, import a package with default implementation.
Would be nice to have either endpoints without any concrete implementation, or switch between Alamofire and pure URLSession. For instance, we are not using Alamofire since many years. URLSession + Swift concurrency seems enough.