Skip to content

Feature/objc tasks 2.3.0#3522

Merged
wing328 merged 9 commits intoswagger-api:2.3.0from
wberger:feature/objc-tasks-2.3.0
Aug 16, 2016
Merged

Feature/objc tasks 2.3.0#3522
wing328 merged 9 commits intoswagger-api:2.3.0from
wberger:feature/objc-tasks-2.3.0

Conversation

@wberger
Copy link
Copy Markdown
Contributor

@wberger wberger commented Aug 4, 2016

@wing328 As agreed in PR #3391 I created a new PR for branch 2.3.0.

This replaces PR #3510.

@wberger wberger mentioned this pull request Aug 4, 2016
@fehguy
Copy link
Copy Markdown
Contributor

fehguy commented Aug 4, 2016

Hi @wberger you may have shared this with @wing328 but what is the goal of this PR? Please create an issue and reference it in your PR, or put in some comments as to what the goal is with breaking the signatures of the generated clients.

@wberger
Copy link
Copy Markdown
Contributor Author

wberger commented Aug 5, 2016

@fehguy @wing328 The original motivation was this issue: #1981

The change to AFHttpSessionManager has been made since then, but I expanded on it by removing the request IDs for pending requests and returning NSURLSessionTasks instead. This allows for real task cancellation and leaves the housekeeping to the OS (see also the explanation below).

Furthermore during integration in our project I ran into the limitation of having only a single global configuration object and not being able to provide a different configurations for different ApiClient instances. Thus I reworked the code to make the configuration a component of the ApiClient which can be passed in during client creation. It results in less global state, higher configurability and less coupling - but only if required, since there are still fallbacks to global defaults.

Thus the only breaking change in the API is the return value of the API calls (NSURLSessionTask * instead of NSNumber *) and the renaming of the default configuration object from {{classPrefix}}Configuration to {{classPrefix}}DefaultConfiguration.

The original description of the changes can be found in PR #3391:

I propose a change to the objc ApiClient. Instead of internally created and maintained request IDs the API implementation should return NSURLSessionTasks. This change has two advantages:

  • Less internal state
  • These task object provide real cancellation as compared to the request ID based implementation (even if the task is currently running)

Furthermore I changed the configuration object to be protocol based in order to allow for more flexible integration into projects and more complex configuration setups. A default configuration implementation is provided and can be passed in, if no custom implementation is required.

@wing328 wing328 added this to the v2.3.0 milestone Aug 5, 2016
@mateuszmackowiak
Copy link
Copy Markdown
Contributor

@wing328 👍 Looks good to me

@wing328 wing328 merged commit 500f419 into swagger-api:2.3.0 Aug 16, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Aug 17, 2016

Upgrade Note

(1) {classPrefix}Configuration has been renamed to {classPrefix}DefaultConfiguration, e.g.
Before:

    SWGConfiguration *config = [SWGConfiguration sharedConfig];

After:

    SWGDefaultConfiguration *config = [SWGDefaultConfiguration sharedConfig];

(2) Return type for API functions has been changed from NSNumber* to NSURLSessionTask*, e.g.
Before

-(NSNumber*) addPetWithBody: (SWGPet*) body

After

-(NSURLSessionTask*) addPetWithBody: (SWGPet*) body

wing328 pushed a commit to wing328/swagger-codegen that referenced this pull request Jan 29, 2017
* change api and ApiClient to return cancellable NSURLSessionTasks instead of NSNumber

* define a configuration protocol for custom configurations, which can be passed to api clients instead of a global configuration, provide a default implementation with a singleton option

* integrate a workaround for a current JSONModel concurrency bug

* update to new ISO8601 pod

* add missing call to super

* integrate new templates into codegen

* updates documentation templates

* updates petstore objc generated code

* fixes objc client tests
wing328 added a commit that referenced this pull request Jan 29, 2017
* Feature/objc tasks 2.3.0 (#3522)

* change api and ApiClient to return cancellable NSURLSessionTasks instead of NSNumber

* define a configuration protocol for custom configurations, which can be passed to api clients instead of a global configuration, provide a default implementation with a singleton option

* integrate a workaround for a current JSONModel concurrency bug

* update to new ISO8601 pod

* add missing call to super

* integrate new templates into codegen

* updates documentation templates

* updates petstore objc generated code

* fixes objc client tests

* [ObjC] Add version define and share default headers of each client

* add finch generator and resource

* update license, add errros

* Fix problem with multitheard api client

* fix some errors for finch

* [finch] Remove license header

* [finch] Remove finatra stuff, fix a few issues

* WIP: Finch server generator

* [finch] WIP: server generator impl

This puts parameters (input/output) in the right format. Currently, this
is done in the generator class using vendorExtensions, but should be
refactored to imported templates to clean up.

Previous commits of the server generator output to appropriate
models/api directories. I've made no changes to this logic, but code
currently generates to the root scala package directory. This will need
to be fixed.

There's also an issue with circe's and Option[Date] in the Order type.
This issue will need to be resolved. As well, there's some unused
imports to clean up.

Initial implementation lacks support for custom imports, type mappings,
etc.

* [finch] Update api/model package and imports

* [finch] Explicit import/type mappings

* [finch] Regenerate example
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
* Feature/objc tasks 2.3.0 (swagger-api#3522)

* change api and ApiClient to return cancellable NSURLSessionTasks instead of NSNumber

* define a configuration protocol for custom configurations, which can be passed to api clients instead of a global configuration, provide a default implementation with a singleton option

* integrate a workaround for a current JSONModel concurrency bug

* update to new ISO8601 pod

* add missing call to super

* integrate new templates into codegen

* updates documentation templates

* updates petstore objc generated code

* fixes objc client tests

* [ObjC] Add version define and share default headers of each client

* add finch generator and resource

* update license, add errros

* Fix problem with multitheard api client

* fix some errors for finch

* [finch] Remove license header

* [finch] Remove finatra stuff, fix a few issues

* WIP: Finch server generator

* [finch] WIP: server generator impl

This puts parameters (input/output) in the right format. Currently, this
is done in the generator class using vendorExtensions, but should be
refactored to imported templates to clean up.

Previous commits of the server generator output to appropriate
models/api directories. I've made no changes to this logic, but code
currently generates to the root scala package directory. This will need
to be fixed.

There's also an issue with circe's and Option[Date] in the Order type.
This issue will need to be resolved. As well, there's some unused
imports to clean up.

Initial implementation lacks support for custom imports, type mappings,
etc.

* [finch] Update api/model package and imports

* [finch] Explicit import/type mappings

* [finch] Regenerate example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants