Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1.04 KB

File metadata and controls

28 lines (21 loc) · 1.04 KB

SwiftGithubOpenAPI

Taking Github's OpenAPI.yaml file and pairing it with swift-openapi-generator

Setup

This uses Github OpenAPI OpenAPI yaml as source input. Specificaly this file.

This branch builds sources through the generator plugin.

The following was done to make it build:

  1. All yaml paths: operations were removed.
  2. webhooks: was renamed to paths:
  3. All externalDocs: were removed

Basic usage

When using JSONDecoder to decode the types, you'll want to use .iso8601 date decoding.

import Push

func foo(data: Data) throws {
        let decoder = JSONDecoder()
        decoder.dateDecodingStrategy = .iso8601
        
        let data = pushEventString.data(using: .utf8)!
        
        let decoded = try decoder.decode(Push.Components.Schemas.WebhookPush.self, from: data)
        print(decoded)
}