Skip to content

mheh/SwiftGithubOpenAPI

Repository files navigation

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)
}

About

Github's Webhook OpenAPI and swift-openapi-generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published