Swagger-codegen: [Objective-C] Feature Request: Use AFHttpSessionManager instead of AFHTTPRequestOperationManager

Created on 26 Jan 2016  Â·  9Comments  Â·  Source: swagger-api/swagger-codegen

Currently the client's inherit from AFHTTPRequestOperationManager, which is no longer supported in AFNetworking 3.

Regarding future updates it would be great to have it use AFHttpSessionManager instead. This way the generated code should be compatible with both AFNetworking 2 and 3.

Objc help wanted

All 9 comments

@wberger thanks for pointing it out. Would have cycle to help make the change to use AFHttpSessionManager instead?

Hi,

I have started with a generator that is based on AFHttpSessionManager. For now it is implemented in a custom module and does not support all features of the standard AFHTTPRequestOperationManager version, as I currently don't have the time to test the currently missing features.

Maybe someone could pick that up? Here is the link to the current implementation, which I think is not yet ready for a pull request:

objc-SessionManager Module

In general, it stays close to the original implementation. The only major change I made was that the session manager implementation receives the configuration (defined via a protocol) during initialization and does not access it via a shared configuration singleton.

- (instancetype)initWithConfiguration:(id<{{classPrefix}}Configuration>)configuration;

In case someone does not want to implement such a configuration, a default configuration implementation is available (also as a singleton) which will be used as a fallback. I believe, that this increases configurability.

@wing328 Do you have any feedback on this? I think the suggested approach should work quite well, but I need some input from someone who has the bigger picture in mind in order to cover all intended use cases.

@wberger sorry I missed your update earlier. I'll take a closer later today or tomorrow and then get back to you.

@wberger do you mind submitting a PR based on your work so far? That way the community can more easily pick it up and comment on the code if they've any question about the change. Thanks!

(please also rebase on the latest master)

@wberger any plans to submit a PR? I can take a look too.

@wberger I would suggest you still submit a PR for your partial work so far so that the community can help work on it.

Currently, I don't have a lot of time available, but I'll try to prepare
the PR.

Good news: in the meantime, I have used the generator with AFNetworking 3
and it seems to work well.

Am 28.04.2016 um 06:38 schrieb wing328 [email protected]:

@wberger https://github.com/wberger I would suggest you still submit a PR
for your partial work so far so that the community can help work on it.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/swagger-api/swagger-codegen/issues/1981#issuecomment-215308222

I created a PR, which builds on the current master and adds some further configurability + support for cancellable NSURLSessionTasks.

3391

Was this page helpful?
0 / 5 - 0 ratings