feat(sdk-generator): Swift SDK + contract-test backends - #55
Merged
calvin-archastro merged 1 commit intoJul 21, 2026
Merged
Conversation
New --lang swift and --lang contract-tests-swift targets emitting an idiomatic async Swift SDK (Codable models, resource classes, channels, auth, PlatformClient) plus swift-testing contract suites that drive the same Prism mock and channel-harness service as the TS/Python tests. - backends/swift/: model/resource/namespace/auth/client/channel emitters with a global type-name registry (Swift compiles the SDK as a single module, so schema/input/response/channel type names share a namespace; claiming in canonical order keeps the SDK and contract-test generator runs byte-reproducible) - contract-tests/: swift-emitter + channel-emitter-swift + swift-values (typed struct initializers with hoisted-name derivation) - value-generator/method-chain-builder: lang unions widened to "swift" - response-shape classification shared with the Python backend so Swift assertions can never drift from emitted deserialization behavior Verified against specs/platform-openapi.json in the archastro-swift package: 946 tests in 44 suites pass (REST vs Prism, 3 channel suites + SSE stream suite vs channel-harness), generation is deterministic. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new generator targets:
--langswiftcontract-tests-swiftThe consuming package lives in the new (private)
ArchAstro/archastro-swiftrepo, which mirrorsarchastro-python's split: generated code + a hand-maintained runtime (HttpClientwith one-shot deduplicated 401 refresh,JSONValue, Phoenix v2Socket/ChanneloverURLSessionWebSocketTask).Design notes
SwiftNameRegistryclaimed in canonical order. This resolves real collisions (the spec'sAuthTokensschema vs. the generated auth-tokens struct) and keeps the separateswiftandcontract-tests-swiftgenerator runs name-compatible and byte-reproducible.ApiError).value-generator/method-chain-builderlang unions widened to"swift"; TS/Python output is unchanged (all 313 unit tests + 63 channel-harness integration tests pass).Verification
Against
specs/platform-openapi.jsoninarchastro-swift:swift testwith channel tests enabled: 946 tests in 44 suites, all passing (37 REST suites vs Prism, 3 channel suites + 1 SSE stream suite vs the real channel-harness subprocess, 16 runtime unit tests)npm run lint,npx tsc,npm test(313 tests) cleanFollow-up
@archastro/sdk-generator@0.8.0unlocks registry-based regeneration inarchastro-swift(its regen script currently supportsARCHASTRO_SDK_GENERATOR_BINfor local use).🤖 Generated with Claude Code