Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Swift] Add option parameter to select response queue #4591

Merged
merged 6 commits into from
Nov 26, 2019
Merged

[Swift] Add option parameter to select response queue #4591

merged 6 commits into from
Nov 26, 2019

Conversation

yosshi4486
Copy link
Contributor

@yosshi4486 yosshi4486 commented Nov 23, 2019

Description of the PR

Proposed feature for [REQ] [Swift] Select response queue

@jgavris @ehyche @Edubits @jaz-ah @d-date

close #4590

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@4brunu
Copy link
Contributor

4brunu commented Nov 24, 2019

This is nice, because it maintains backwards compatibility and it's configurable.
Can you please run ./bin/swift4-all.sh to update all sample projects?

Run ./bin/swift4-all.sh then remove unrelated diff.
@@ -11,6 +11,7 @@ open class {{projectName}}API {
public static var credential: URLCredential?
public static var customHeaders: [String:String] = [:]
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
public static var queue: DispatchQueue = .main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syatyo what do you think of giving this a more specific name?
Something like APIResponseQueue or something like that.
It's just to avoid confusion in case more configurable queue's are added in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names in swift start with lowercase, so maybe something like apiResponseQueue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better! I will try it.

Rename queue to apiResponseQueue, because apiResponseQueue is more clear for explaining the context.
@4brunu
Copy link
Contributor

4brunu commented Nov 24, 2019

Thanks for the changes, for me it looks good 🙂

@wing328
Copy link
Member

wing328 commented Nov 25, 2019

@syatyo thanks for the PR. Can you please resolve the merge conflicts when you've time?

@@ -11,6 +11,7 @@ open class {{projectName}}API {
public static var credential: URLCredential?
public static var customHeaders: [String:String] = [:]
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
public static var apiResponseQueue: DispatchQueue = .main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syatyo Since now the Swift generator support the visibility modifier, this line should become
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiResponseQueue: DispatchQueue = .main

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to fix it via 404288d

@wing328
Copy link
Member

wing328 commented Nov 26, 2019

@syatyo All tests passed. Thanks for the PR.

@4brunu thanks for reviewing the change.

@wing328 wing328 merged commit 2f26812 into OpenAPITools:master Nov 26, 2019
@yosshi4486
Copy link
Contributor Author

@wing328 Thanks for resolving conflics!

@wing328
Copy link
Member

wing328 commented Dec 2, 2019

@syatyo thanks for the PR, which has been included in the v4.2.2 release: https://twitter.com/oas_generator/status/1201432648544972800

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.

[REQ] [Swift] Select response queue
3 participants