Fix #2120, #2157 - Update Swift API method generation for ease of use #2244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #2120, #2157 -- Note this is a Breaking Change.
The following illustrates the differences in the usage of generated SDK:
Before:
After:
PromiseKit ready version of simplified methods are also generated:
Before:
After:
The
{{projectName}}API
namespace for API classes (PetstoreClientAPI
above) now became optional and can be turned on via a CLI option:-D swiftUseApiNamespace=true
In order to allow developers to access the response object when needed, the old methods still exist with
WithRequestBuilder
added to the end of the method name:Before:
After:
I initially thought to provide an improved abstraction over these
WithRequestBuilder
methods (to make them look closer to C#'sWithHttpInfo
methods), but it will involve more lines to add (esp. to provide PromiseKit ready version). I thought it better be done in a separate PR.