Slide 1

Slide 1 text

Continuous Integrate RESTful API with Swagger-codegen Daiki Matsudate / @d_date 2018/04/14 / Hakata.swift #1

Slide 2

Slide 2 text

Daiki Matsudate @d_date

Slide 3

Slide 3 text

ٕज़ॻయ4 ͘-03

Slide 4

Slide 4 text

Thank you!!

Slide 5

Slide 5 text

try! Swift NYC Sep. 4th & 5th

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Open Source Contributor

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Japanese: https://note.mu/d_date/n/nbecc56fe366c English: https://medium.com/@d_date/became-a-member- of-swagger-codegen-technical- committee-4965303ba5a4

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

• Managing your API Spec (Open API Spec: OAS) with yaml file • Generate client / server side code with swagger-codegen • Building Mock server

Slide 14

Slide 14 text

https://github.com/swagger-api/ swagger-codegen

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

https://speakerdeck.com/susieyy/ swaggerdeshi-meruapiding-yi-guan-li- tokodozienereto

Slide 17

Slide 17 text

Swagger-Codegen for Swift • Swift 4.1 available (still using flatMap: not compactMap:) • Codable protocol • Required / Optional with Swift.Optional • API Client with Alamofire • RxSwift / PromiseKit / Default interface

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

https://speakerdeck.com/d_date/ swagger-codegen-karatiao-meru- swift4

Slide 20

Slide 20 text

Swagger-codegen x Circle CI

Slide 21

Slide 21 text

swagger-api / swagger-codegen swagger.yaml swagger-codegen -l swift4 -i swagger.yaml

Slide 22

Slide 22 text

Automation with Swagger API.framework

Slide 23

Slide 23 text

Automation with Swagger in Swift API.framework carthage update —-platform ios

Slide 24

Slide 24 text

Automation with Swagger • circleci/openjdk:8-jdk-browsers • Run java -jar swagger-codegen-cli.jar generate -l swift4 -l swagger.yaml • Commit & push to github • Publish your code to Github Release (to make latest build) Upload client code to repo for api curl -H “Authorization: token $(GITHUB_ACCESS_TOKEN)” -X POST -d “{\”tag_name\”: \”$API_VERSION\”} -v https://github.com/repos/ #{organization name}/{repo name}/releases API.framework

Slide 25

Slide 25 text

Automation with Swagger • brew tap yonaskolb/XcodeGen https://github.com/yonaskolb/Xcodegen.git | brew install XcodeGen • xcodegen • Git push • Carthage build —no-skip-current —platform iOS | Carthage archive • Sh git_release.sh github_api_token=${GITHUB_ACCESS_TOKEN} owner={owner} repo={repo name} tag=LATEST filename=API.framework.zip (to upload your framework as binary) Generating xcode project for api client API.framework

Slide 26

Slide 26 text

Automation with Swagger • Write github {organization name}/{repo name} in your Cartfile • Run carthage update —platform iOS Download latest framework with Carthage API.framework

Slide 27

Slide 27 text

XcodeGen • Specify all your properties in your project.yml • Targets • Dependencies (cocoapods / Carthage) • settings ( reveal on project settings) • Scheme • Build scripts • Just run `xcodegen` Build your pbxproj. with project.yml

Slide 28

Slide 28 text

https://github.com/yonaskolb/ Xcodegen

Slide 29

Slide 29 text

Recap • Managing your API spec with Swagger • Building your API Client with Swagger-codegen • You can get Continuous Integrated API Client with Swagger-codegen x Cirlcle CI • You can get latest maintained Swagger-codegen with your PR

Slide 30

Slide 30 text

Thank you!!