postmanlabs / postmanlabs/postman-code-generators
Code Generator for Swift Async/Await
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 381
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
It's not related to a problem
Describe the solution you'd like
In the Swift Codegen for URLSession the template is given a "closure" based approach. The language has moved away from 1+ years now. I would like to update the template
Additional context
Previously
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://test-websvcs.nm.org/BusAdmin/Services/WebAPI/NMEmployeeMiddleTier/NMConnectAdmin/CurrentDate")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Now
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var request = URLRequest(url: URL(string: "https://test-websvcs.nm.org/BusAdmin/Services/WebAPI/NMEmployeeMiddleTier/NMConnectAdmin/CurrentDate")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(from: request)
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by locating the Swift Codegen template for URLSession and compare its generated closure-based example with the requested async/await form; done means generated Swift code uses async/await without the semaphore and completion-handler pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100