# apple/swift-openapi-generator

Generate Swift client and server code from an OpenAPI document.

Repository: https://github.com/apple/swift-openapi-generator
Canonical: https://ross.abutalabs.com/products/swift-openapi-generator
Homepage: https://swiftpackageindex.com/apple/swift-openapi-generator/documentation
Language: Swift
License: Apache-2.0
License Family: permissive
Topics: ios-swift, openapi, server-side-swift, swift, plugin, swiftpm
Last push: 2026-08-26T12:10:45+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 92, longevity 87
- inputs: {"age_days": 1231, "days_push": 7, "days_rel": 58, "gap_med": 27.0, "n_releases_24m": 21}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1961, forks 180 (observed 2026-08-28T04:05:59.547545+00:00)

## What it is
A Swift package plugin that generates type-safe Swift client and server code from OpenAPI 3.x documents at build time. Generated code is decoupled from HTTP libraries via transport abstractions, supporting streaming bodies and multiple content types.

## Use cases
- generate a swift client from an openapi spec
- build a type-safe swift http server from an openapi document
- keep ios app api client code in sync with the backend spec
- implement server stubs for a rest api in swift
- avoid hand-writing boilerplate http request and response code

## When to choose
- you develop in Swift and have an OpenAPI document for your API
- you want build-time code generation so client and server code always matches the spec
- you need framework-agnostic generated code that works with URLSession, Vapor, or other transports

## When to avoid
- your API is not described by an OpenAPI document
- you need runtime schema validation or dynamic clients rather than compile-time generated code
- you work outside the Swift ecosystem

## Facets
- artifact type: plugin
- maturity: active
- function: api-framework, http-client, http-server, serialization
- domain: apis, web-development, developer-tools, backend, mobile-development
- platform: cross-platform
- tags: openapi, swiftpm-plugin, code-generation, client-server, type-safe-api, codegen, swift, ios, macos, linux

## Member repositories
- apple/swift-openapi-generator (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:59.547545+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:05:37.220976+00:00, confidence not recorded.
  - readme: https://github.com/apple/swift-openapi-generator (fetched 2026-08-28T04:05:59.547545+00:00, sha 9d31f182d4db)
- Data as of 2026-08-30T08:39:29.467469+00:00.
