Openapi-generator: Add Support for Swift's AsyncHTTPClient

Created on 10 Jan 2020  路  1Comment  路  Source: OpenAPITools/openapi-generator

AsyncHTTPClient is a new HTTP client library for Swift built on SwiftNIO. This library utilizes non-blocking IO which makes it ideal for use Swift servers.

From what I can tell OpenAPI Generator currently supports generating Swift 5 clients based on URLSession, Alamofire, and RxSwift. It would be great if we could add support for AsyncHTTPClient so that servers could generate non-blocking clients to interact with OpenAPI-compatible APIs.

Swift Suggestion

Most helpful comment

Hey, here are some tips on how to add another http client library to swift 5 generator, if someone wants to take this task. I can help with guidance and code review.

The first thing it's to subclass RequestBuilder to implement the network stack with the library that you want. Here are two examples of that with URLSession and Alamofire.

Then create an implementation for RequestBuilderFactory that returns your new network stack implementation. Here are two examples of this with URLSession and Alamofire.

Then swap the network factory in PetstoreClientAPI.requestBuilderFactory.

Here is a PR that adds URLSession support and shows all of this.

Hope it helps 馃檪

>All comments

Hey, here are some tips on how to add another http client library to swift 5 generator, if someone wants to take this task. I can help with guidance and code review.

The first thing it's to subclass RequestBuilder to implement the network stack with the library that you want. Here are two examples of that with URLSession and Alamofire.

Then create an implementation for RequestBuilderFactory that returns your new network stack implementation. Here are two examples of this with URLSession and Alamofire.

Then swap the network factory in PetstoreClientAPI.requestBuilderFactory.

Here is a PR that adds URLSession support and shows all of this.

Hope it helps 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dkliban picture dkliban  路  24Comments

atomfrede picture atomfrede  路  21Comments

jonrimmer picture jonrimmer  路  80Comments

MartinDelille picture MartinDelille  路  35Comments

samarthgupta437 picture samarthgupta437  路  21Comments