https://github.com/ruddfawcett/ios-openapi-gen
Generate iOS client API wrappers from Swagger's OpenAPI spec.
https://github.com/ruddfawcett/ios-openapi-gen
api-wrapper generate ios openapi3 swagger-api
Last synced: 9 months ago
JSON representation
Generate iOS client API wrappers from Swagger's OpenAPI spec.
- Host: GitHub
- URL: https://github.com/ruddfawcett/ios-openapi-gen
- Owner: ruddfawcett
- Created: 2020-04-30T21:11:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T23:53:36.000Z (almost 6 years ago)
- Last Synced: 2025-06-09T01:33:38.162Z (9 months ago)
- Topics: api-wrapper, generate, ios, openapi3, swagger-api
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ios-openapi-gen
🎁 Wrap Swagger OpenAPIs with an API pattern developed by [@kean](https://kean.github.io/post/api-client). Right now the project will do everything but function names, but will tackle that soon.
## Usage
- 🧑💻 grab latest `openapi.json`
- 📝 edit settings in `settings.yml`
- 🛠 run `python gen.py`
- 🔎 go to `output/*`
- 😎 use generated Swift API layer
## Example Output
```swift
extension API {
enum Store {}
}
extension API.Store {
/// Returns pet inventories by status
static func <# Readable Name #>() -> Endpoint<<# Model Type/Void #>> {
return Endpoint(method: .get, path: "/store/inventory")
}
/// Place an order for a pet
static func <# Readable Name #>() -> Endpoint<<# Model Type/Void #>> {
return Endpoint(method: .post, path: "/store/order")
}
/// Find purchase order by id
static func <# Readable Name #>(orderId: Int) -> Endpoint<<# Model Type/Void #>> {
return Endpoint(method: .get, path: "/store/order/\(orderId)")
}
/// Delete purchase order by id
static func <# Readable Name #>(orderId: Int) -> Endpoint<<# Model Type/Void #>> {
return Endpoint(method: .delete, path: "/store/order/\(orderId)")
}
}
```
## Future Plans
- 🤡 parse full documentation for paths
- 📖 generate semi-readable API function names
- 🤗 handle body parameters
- 🖼 support framework/patterns beyond Alamofire
## Colophon
- [@ruddfawcett](https://github.com/ruddfawcett): Python parser and converter for OpenAPIs.
- [@kean](https://kean.github.io/post/api-client): API layer concept, originally written with Alamofire and RxSwift.