22
STREAMLINING API WITH SWAGGER.IO VICTOR AUGUSTEO

Streamlining API with Swagger.io

Embed Size (px)

Citation preview

Page 1: Streamlining API with Swagger.io

STREAMLINING API WITH SWAGGER.IO

VICTOR AUGUSTEO

Page 2: Streamlining API with Swagger.io

SHORT PROFILE

▸ Victor Augusteo

▸ Frontend engineer @ PwC Experience Centre

▸ Mostly iOS and web apps

[email protected]

▸ linkedin.com/in/victoraugusteo

Page 3: Streamlining API with Swagger.io

QUICK OVERVIEW

▸ 2 parts talk

▸ intro to swagger

▸ live demo

▸ for front, back-end and test engineers

▸ how swagger would be useful for you

▸ be aware that it is an option

Page 4: Streamlining API with Swagger.io

CONVENTIONAL API LIFECYCLE

BACKEND IMPLEMENTS API

BACKENDS TELLS FRONTEND THE

DETAILS

FRONTEND CONSUMES THE

API

Page 5: Streamlining API with Swagger.io

OR THE OTHER WAY AROUND

FRONTEND TELLS BACKEND WHAT

API IT NEEDS

BACKEND IMPLEMENTS API

FRONTEND CONSUMES THE

API

Page 6: Streamlining API with Swagger.io

USUALLY RESULTING IN

▸ lots of back and forth between frontend-backend

▸ non-standardized api style (usually)

▸ extra step to write documentation outside codebase

▸ multiple sources-of-truth

▸ need to test using REST clients like curl or Paw

Page 7: Streamlining API with Swagger.io
Page 8: Streamlining API with Swagger.io

WOULDN’T IT BE AWESOME FOR A TOOL TO SOLVE ALL OUR PROBLEMS?

Page 9: Streamlining API with Swagger.io

ENTER SWAGGER.IO

Page 10: Streamlining API with Swagger.io

SO WHAT IS IT?

▸ swagger

▸ codegen

▸ ui

▸ editor

▸ OpenAPI-Spec

Page 11: Streamlining API with Swagger.io

SWAGGER

▸ the brain - generates and consume swagger file

▸ java, js, node authored by the swagger team

▸ and many community driven language integrations

Page 12: Streamlining API with Swagger.io

CODEGEN

▸ stub code generator for server and client

Page 13: Streamlining API with Swagger.io

UI

dependency-free html for api documentation and sandbox, serves as the contract between front/backend devs

Page 14: Streamlining API with Swagger.io

EDITOR

live edit swagger file (JSON/YAML), codegen, example, etc.

Page 15: Streamlining API with Swagger.io

OPENAPI SPECIFICATION

‣ a set of standards on how to write your api

‣ popular ~ 3000 ⭐on github, backed by Linux foundation

Page 16: Streamlining API with Swagger.io

HOW DO YOU USE IT?

▸ start with swagger definitions, generate the server & client code then flesh out the implementations

▸ if you have existing project and you are using supported frameworks, then swagger definitions can be automatically generated for you given you write swagger comments in the API points

▸ Node, Java, JS, .Net, PHP, Python, Ruby, Scala, etc.

▸ full list @ http://swagger.io/open-source-integrations/

Page 17: Streamlining API with Swagger.io

QUICK LIVE DEMO!

▸ run swagger-editor locally

▸ use swagger editor to create api spec

▸ hello world api & sum two numbers api

▸ generate server stub in Ruby Sinatra and run it on localhost

▸ consume the api with generated Swift client

Page 18: Streamlining API with Swagger.io
Page 19: Streamlining API with Swagger.io

1. RUN SWAGGER-EDITOR LOCALLY

Page 20: Streamlining API with Swagger.io

SWAGGER HELPS US TO

▸ communicate more effectively

▸ standardized api across engineers

▸ easy to use generated documentation

▸ single source of truth

▸ built in REST client to test

Page 21: Streamlining API with Swagger.io

RESOURCES LINKS

▸ http://swagger.io

▸ https://github.com/OAI/OpenAPI-Specification

▸ email me [email protected]

▸ connect on linkedin.com/in/victoraugusteo

Page 22: Streamlining API with Swagger.io

QUESTIONS ?I HAS BEEN AN HONOR!