Continuous Integrate RESTful API with Swagger-codegen

2594ac7ce91fd7d9a3ce71ca7cc2d0c0?s=47 d_date
April 14, 2018

Continuous Integrate RESTful API with Swagger-codegen

2018/4/14 Hakata.swift #1

2594ac7ce91fd7d9a3ce71ca7cc2d0c0?s=128

d_date

April 14, 2018
Tweet

Transcript

  1. Continuous Integrate RESTful API with Swagger-codegen Daiki Matsudate / @d_date

    2018/04/14 / Hakata.swift #1
  2. Daiki Matsudate @d_date

  3. ٕज़ॻయ4 ͘-03

  4. Thank you!!

  5. try! Swift NYC Sep. 4th & 5th

  6. None
  7. None
  8. Open Source Contributor

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

  11. None
  12. None
  13. • Managing your API Spec (Open API Spec: OAS) with

    yaml file • Generate client / server side code with swagger-codegen • Building Mock server
  14. https://github.com/swagger-api/ swagger-codegen

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

  17. 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
  18. None
  19. https://speakerdeck.com/d_date/ swagger-codegen-karatiao-meru- swift4

  20. Swagger-codegen x Circle CI

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

  22. Automation with Swagger API.framework

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

  24. 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
  25. 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
  26. Automation with Swagger • Write github {organization name}/{repo name} in

    your Cartfile • Run carthage update —platform iOS Download latest framework with Carthage API.framework
  27. 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
  28. https://github.com/yonaskolb/ Xcodegen

  29. 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
  30. Thank you!!