Use @discardableResult consistently on completion-handler methods
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start by locating OpenAIProtocol, ResponsesEndpointProtocol, OpenAI, and ResponsesEndpoint, then inspect their completion-handler methods returning CancellableRequest. Add @discardableResult consistently to those methods and run swift package diagnose-api-breaking-changes; the command should report no API breaking changes.
Written by the indexing model from the issue text.
Description
Completion-handler methods return a CancellableRequest, which callers often don't need. Whether discarding it produces an "unused result" warning currently depends on the method:
| Protocol | Methods returning CancellableRequest |
With @discardableResult |
|---|---|---|
OpenAIProtocol |
27 | 24 (missing: audioCreateSpeechStream, audioTranscriptionStream, audioTranscriptionsVerbose) |
ResponsesEndpointProtocol |
4 | 0 |
FilesEndpointProtocol (#401) |
5 | 5 |
Add @discardableResult to every completion-handler method that returns a CancellableRequest, in the protocols and in the concrete implementations (OpenAI, ResponsesEndpoint). Callers that use the concrete types directly get the same behaviour that way.
Adding @discardableResult is source-compatible: it only removes a warning. Run swift package diagnose-api-breaking-changes to confirm it reports nothing.
- Dominant language
- Swift
- Stars
- 2.9k
- Forks
- 519
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from MacPaw/OpenAI
-
Enable batch promptsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MacPaw/OpenAI#73 · 1 comment · 1 reaction ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 3 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 3 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
Maintainers usually reply within 3 days
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
altic-dev/FluidVoice#1117 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
omacom/try-omarchy#343 ·
Maintainers usually reply within 1 day
-
install.ps1: Windows PowerShell 5.1 aborts after a successful cosign verification (NativeCommandError on 'Verified OK')Possibly taken @sly321-pixel claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OneBusAway/onebusaway-ios#1518 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
vorssaint/vorssaint-utils#3030 ·
Maintainers usually reply within 1 day