Typed composition
allOfintersects types and combines compatible object fields while preserving original validation boundaries.anyOfandoneOfretain a common Swift output type or generate nested publicSendableenums for different payload types.- Generated union cases follow branch order (
option1,option2, ...); nested objects, arrays, nullable values, and references are supported. notpreserves the surrounding output type while enforcing the negated schema.- Structural
$refsiblings now use the same output-shaping rules asallOf. - Requires swift-json-schema 0.13.2, which corrects schema-aware composition branch selection. Branches no longer match based only on successful Swift type parsing.
OpenAPI integration
The offline OpenAPISchemaGenerator adapter generates the supported JSON Schema subset of OpenAPI 3.1 JSON components.schemas, preserving original names, references, and identifier scopes.
The Style API example generates Swift and compiles a separate consumer covering shared typography/color definitions, allOf themes, same-output font unions, and typed ready/pending response variants.
This is not an HTTP client generator or full OpenAPI validator. YAML, OpenAPI 3.0, dynamic/recursive references, custom dialects, and OpenAPI-only schema keywords such as discriminator remain unsupported.
Package metadata
- Added
.spi.ymldocumentation targets for Swift Package Index. - Added CI, supported Swift versions, and supported platforms badges.
- CI covers package suites, the build-plugin consumer, and the generated OpenAPI consumer on macOS and Linux.
Integrating the shared core
Custom frontends must emit all GeneratedSchema.declarations inside the same namespace as schema; the list can contain public enum declarations and private static helpers. The bundled macro, CLI, and plugin already do this.
.package(
url: "https://github.com/ajevans99/swift-json-schema-codegen.git",
from: "0.2.0"
)