yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
626 stars 146 forks source link

Swift template: remove Alamofire? #44

Open yonaskolb opened 6 years ago

yonaskolb commented 6 years ago

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?

bjtitus commented 6 years ago

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.

b00tsy commented 5 years ago

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...

yonaskolb commented 5 years ago

The Result dependency has been removed here https://github.com/yonaskolb/SwagGen/pull/174

szotp commented 5 years ago

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.

vgorloff commented 1 year ago

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.