apple / apple/swift-openapi-generator

Don't emit deprecation warnings (coming from openapi-generated code)

Open
#715 7 comments 0 reactions 0 assignees View on GitHub
kind/feature status/triage
Dominant language
Swift
Stars
2k
Forks
182
Avg merge
13h 28m
Merged PRs (30d)
5

Description

### Motivation

```bash
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2886:22: warning: 'hasDownloads' is deprecated
2884 | self.hasWiki = hasWiki
2885 | self.hasPages = hasPages
2886 | self.hasDownloads = hasDownloads
| `- warning: 'hasDownloads' is deprecated
2887 | self.hasDiscussions = hasDiscussions
2888 | self.archived = archived
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2900:22: warning: 'useSquashPrTitleAsDefault' is deprecated
2898 | self.deleteBranchOnMerge = deleteBranchOnMerge
2899 | self.allowUpdateBranch = allowUpdateBranch
2900 | self.useSquashPrTitleAsDefault = useSquashPrTitleAsDefault
| `- warning: 'useSquashPrTitleAsDefault' is deprecated
2901 | self.squashMergeCommitTitle = squashMergeCommitTitle
2902 | self.squashMergeCommitMessage = squashMergeCommitMessage
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2886:22: warning: 'hasDownloads' is deprecated
2884 | self.hasWiki = hasWiki
2885 | self.hasPages = hasPages
2886 | self.hasDownloads = hasDownloads
| `- warning: 'hasDownloads' is deprecated
2887 | self.hasDiscussions = hasDiscussions
2888 | self.archived = archived
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2900:22: warning: 'useSquashPrTitleAsDefault' is deprecated
2898 | self.deleteBranchOnMerge = deleteBranchOnMerge
2899 | self.allowUpdateBranch = allowUpdateBranch
2900 | self.useSquashPrTitleAsDefault = useSquashPrTitleAsDefault
| `- warning: 'useSquashPrTitleAsDefault' is deprecated
2901 | self.squashMergeCommitTitle = squashMergeCommitTitle
2902 | self.squashMergeCommitMessage = squashMergeCommitMessage
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2886:22: warning: 'hasDownloads' is deprecated
2884 | self.hasWiki = hasWiki
2885 | self.hasPages = hasPages
2886 | self.hasDownloads = hasDownloads
| `- warning: 'hasDownloads' is deprecated
2887 | self.hasDiscussions = hasDiscussions
2888 | self.archived = archived
/__w/penny-bot/penny-bot/Lambdas/GitHubAPI/GeneratedSources/Types.swift:2900:22: warning: 'useSquashPrTitleAsDefault' is deprecated
2898 | self.deleteBranchOnMerge = deleteBranchOnMerge
2899 | self.allowUpdateBranch = allowUpdateBranch
2900 | self.useSquashPrTitleAsDefault = useSquashPrTitleAsDefault
| `- warning: 'useSquashPrTitleAsDefault' is deprecated
2901 | self.squashMergeCommitTitle = squashMergeCommitTitle
2902 | self.squashMergeCommitMessage = squashMergeCommitMessage
```

### Proposed solution

I think we could have settings like "upgrade_deprecations_to_unavailabilities" or "don't_mark_as_deprecated_at_all".
Or maybe if we annotate the initializer with the deprecations as well, we can somehow manage not breaking users while also not emitting warnings? we might need 2 inits, one with all properties including deprecateds, and one with no deprecated parameters in it.

### Alternatives considered

Live with the warnings?

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the generated initializer in Lambdas/GitHubAPI/GeneratedSources/Types.swift around lines 2886 and 2900, where the deprecation warnings occur. Trace how this generated code is configured, then define and verify a supported approach that avoids warnings for deprecated properties without breaking users who need them.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, swift
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.