Swiftpack.co -  alxdrlitreev/swift-oapi-generator as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
alxdrlitreev/swift-oapi-generator
Generate Swift structs from OpenAPI
.package(url: "https://github.com/alxdrlitreev/swift-oapi-generator.git", from: "1.2.2")

SwiftOAPI

License MIT Swift 5.x

Disclaimer

This OpenAPI 3.0 implementation is incomplete and it does NOT support tags, callbacks & some other things.

Getting started

SwiftOAPI support SPM. You've to add to Package.swift file information about SwiftOAPI. Here's an example.

let package = Package(
    name: "YourApp",
    dependencies: [
        .package(url: "https://github.com/alxdrlitreev/swift-oapi-generator.git")
    ],
    targets: [
        .target(name: "YourApp", dependencies: ["SwiftOAPI"]),
        .testTarget(name: "YourAppTests", dependencies: ["YourApp"])
    ]
)

How to use it

Parsing OpenAPI JSON

SwiftOAPIParser is main class which is responsible for parsing information about our API structure and generating corresponding Swift structures.


let jsonString = <...> // Retrieve OpenAPI JSON from your API provider
let openAPIObject = try! SwiftOAPIParser().parseJSON(from: jsonString)

Licence

This code and tool is under the MIT Licence. See the LICENCE file in this repository.

GitHub

link
Stars: 0
Last commit: 6 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Release 1.2.1 (Implement Date support)
13 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API