feat(swift): generate CONTRIBUTING.md for Swift SDKs#15648
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
|
Self-review: LGTM — No issues found. CI passing, code follows existing Swift generator patterns correctly. Generator path |
There was a problem hiding this comment.
Is there no AsIs pattern to do this with copy/paste file?
There was a problem hiding this comment.
The AsIs pattern in Swift (SourceAsIsFiles/addSourceAsIsFile) is designed for .swift source files that get compiled into the module — they include symbol registration with the NameRegistry and are placed under Sources/. CONTRIBUTING.md is a root-level markdown file, so it follows the same addRootFiles(new File(...)) pattern used by README.md, reference.md, and Package.swift.
This also matches how C# and TypeScript handle it — both use a ContributingGenerator class with addRawFiles/addRootFiles rather than an AsIs file.
That said, if you'd prefer a different approach (e.g. a static .md file that gets copied), happy to refactor.
There was a problem hiding this comment.
Devin it shouldn't be difficult to extend this to allow root AsIs I think. We could just add RootAsIsFiles to AsIs.ts and then generate them in SdkGeneratorCLI generateRootFiles()? Could we not do that?
There was a problem hiding this comment.
Good call — refactored to use the AsIs pattern. I've:
- Added
RootAsIsFilestogenerators/swift/base/src/AsIs.ts— a simpler variant of the existing AsIs registry (justfilename+loadContents, no symbols/directory needed for root files) - Placed the static
CONTRIBUTING.mdatgenerators/swift/base/src/asIs/Root/CONTRIBUTING.md - Updated
SdkGeneratorCli.tsto load viaRootAsIsFiles.Contributing.loadContents()ingenerateRootAsIsFiles(), called in parallel with README/reference generation - Removed the
ContributingGeneratorclass entirely
This makes it easy to add more root AsIs files in the future — just add an entry to RootAsIsFileSpecs and drop the file in asIs/Root/.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Description
Generate a Swift-specific CONTRIBUTING.md for Swift SDKs, using a new
RootAsIsFilespattern that extends the existing AsIs infrastructure for root-level files.Changes Made
generators/swift/base/src/AsIs.tswith aRootAsIsFilesregistry for root-level static files (no symbols needed, just filename + content loading)generators/swift/base/src/asIs/Root/CONTRIBUTING.mdwith Swift-specific content:swift package resolveswift buildswift testswift format ./swiftformat .swiftlintgenerators/swift/as the generator pathgenerators/swift/sdk/src/SdkGeneratorCli.ts:generateRootAsIsFilesmethod that loads and adds root AsIs filesgenerateRootFiles()in parallel with README/reference generation, gated behind!context.config.whitelabelRootAsIsFilesfrom@fern-api/swift-basegenerators/swift/sdk/src/__test__/ContributingGenerator.test.ts:generators/swift/sdk/changes/unreleased/add-contributing-md.ymlTesting
pnpm formatpassesLink to Devin session: https://app.devin.ai/sessions/e318dce18bb44560bd5859fb0d171213
Requested by: @Swimburger