Releases: ajevans99/swift-json-schema-codegen
Release list
0.2.0 - Typed composition and OpenAPI integration
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"
)0.1.0 - Offline schema references
First tagged release of Swift JSON Schema Codegen, built on swift-json-schema 0.13.1.
Included
- Attached
@Schemamacro with automatically derived tuple outputs. - Shared generation core, batch CLI, and SwiftPM build-tool plugin.
- Offline local and cross-document
$defs/$refresolution, canonical and nested$idresources, static anchors, and strict JSON Pointers. - Original-source diagnostics for missing references, duplicate identifiers, and cycles; bounded expansion for large graphs.
- Reference-sibling constraints preserve intersection semantics rather than overwriting referenced constraints.
- Realistic, authored design-token, theme, and application-settings schemas with reusable typography, palettes, spacing, and example JSON payloads.
See the plugin example and README for usage and the supported-keyword matrix.
Requires Swift 6.1 or later. References never trigger implicit disk or network loads. Recursive/dynamic references, input composition, and structural siblings next to $ref remain explicit errors.
Install with .package(url: "https://github.com/ajevans99/swift-json-schema-codegen.git", from: "0.1.0").