Skip to content

banjun/SwiftBeaker

Repository files navigation

CI Build Status

SwiftBeaker

Swift client generator for API Blueprint

Input file is an API Blueprint AST file generated by drafter. Output is a Swift client code (with some dependencies: APIKit, Himotoki, etc)

Examples

see Examples

Real World Examples

banjun/imastodon Mastodon API

Build

debug

% swift build

release (SwiftBeaker/releases)

% swift build -c release

Usage

% drafter -f json api-blueprint-document.md > apib.json # generate AST using drafter (ver. 5)
% SwiftBeaker apib.json > APIClient.swift

for use in a framework target for the API:

% SwiftBeaker --public apib.json > APIClient.swift # public memberwise init & public members

Conversion

SwiftBeaker converts ...

  • each Transitions into a APIKit.Request
  • each Responses bound to a Request into a enum Responses whose cases identified by a pair of status code and content type
  • each Data Structures (named and anonymous) into a Codable struct