apple / apple/swift-openapi-generator
Access modifiers on imports in generated files
- Dominant language
- Swift
- Stars
- 2k
- Forks
- 182
- Avg merge
- 13h 28m
- Merged PRs (30d)
- 5
Description
### Motivation
Starting in Swift 6.0, users can set `InternalImportsByDefault` as an upcoming feature flag, which makes imports internal by default. Then, if they add `accessModifier: package/public`, the code fails to build.
### Proposed solution
There should be some way to get the access modifier added on the imports as well.
One way: put `if #compiler(>=6.0)` around imports with the access modifier, and `#else` won't have it. That way we can do it without other feature flags.
### Alternatives considered
_No response_
### Additional information
_No response_
Contributor guide
Research direction
Locate the generator entry point and the code responsible for rendering imports in generated Swift files. Check how the accessModifier option is propagated, then run the relevant generator tests or fixtures to verify package/public imports compile under Swift 6 while older compiler behavior remains unchanged.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100