36
The Latest and Greatest James Higginbotham @launchany

Swagger 2.0: Latest and Greatest

Embed Size (px)

Citation preview

Page 1: Swagger 2.0: Latest and Greatest

 The  Latest  and  Greatest  

James  Higginbotham  @launchany  

Page 2: Swagger 2.0: Latest and Greatest

SWAGGER  –  OVERVIEW  

Page 3: Swagger 2.0: Latest and Greatest

 Swagger  is  a  simple  yet  powerful  representa<on  of  your  RESTful  API.  

 

Page 4: Swagger 2.0: Latest and Greatest

Drives  API  Documenta>on  

Page 5: Swagger 2.0: Latest and Greatest

Without  Swagger  Defini>on  

Page 6: Swagger 2.0: Latest and Greatest

With  Swagger  Defini>on  

Page 7: Swagger 2.0: Latest and Greatest

Swagger  Structure  -­‐  Info  

Page 8: Swagger 2.0: Latest and Greatest

Swagger  Structure  -­‐  Paths  

Page 9: Swagger 2.0: Latest and Greatest

Swagger  Structure  -­‐  Security    

Page 10: Swagger 2.0: Latest and Greatest

Swagger  Structure  –  Security  Types  

Page 11: Swagger 2.0: Latest and Greatest

Swagger  Structure  -­‐  Defini>ons  

Page 12: Swagger 2.0: Latest and Greatest

Swagger  Data  Types  

Page 13: Swagger 2.0: Latest and Greatest

Swagger  is  much  bigger  than  Swagger-­‐UI  

Page 14: Swagger 2.0: Latest and Greatest

Swagger  Ecosystem  

Page 15: Swagger 2.0: Latest and Greatest

Beyond  Interac>ve  Docs  

Page 16: Swagger 2.0: Latest and Greatest

Beyond  Defini>on:  Visualiza>on  

Swagger.ed    

hMps://github.com/chefArchitect/apispots-­‐browser-­‐swaggered  

Page 17: Swagger 2.0: Latest and Greatest

Swagger  2.0  

u  Released  last  year  u  Evolve  the  JSON  syntax  u Add  support  for  human-­‐friendly  format  u Vendor  extensions  support  

Page 18: Swagger 2.0: Latest and Greatest

From  Reverb  to  SmartBear  

Page 19: Swagger 2.0: Latest and Greatest

Community  Contribu>ons  Growing!  

Page 20: Swagger 2.0: Latest and Greatest

New:  Community-­‐Driven  Website  

u New  website  underway  –  hMp://swagger.io  – Github  driven  – Pages  have  a  “View  Source  on  Github”  link  – For  the  community,  BY  the  community  – Feel  free  to  contribute  content  

Page 21: Swagger 2.0: Latest and Greatest

June  6  Release  

u  SmartBear  tools  now  have  2.0  support  throughout  u  Swagger  JS/UI  

–  Now  upgrade  older  versions  of  Swagger  2.0  before  processing  –  Major  rewrites  of  the  underlying  libraries  of  these  projects  

u  Core  and  Codegen  –  Completely  rewriMen  in  Java  (used  to  be  Scala)  –  BeMer  extension  mechanism  to  allow  for  core  customiza>ons  –  Codegen  has  new  templates  (Swic,  Perl,  updated  JAX-­‐RS)  

u  Governance  –  Crea>ng  an  open  governance  model  for  the  spec  –  Will  involve  other  companies  and  individuals  –  S>ll  figuring  out  the  exact  model  (before  the  end  of  June)  

Page 22: Swagger 2.0: Latest and Greatest

SWAGGER  FOR  A  DESIGN-­‐FIRST  API  

Page 23: Swagger 2.0: Latest and Greatest

Design  First  API  Approach  

Page 24: Swagger 2.0: Latest and Greatest

Design  First  API  Lifecycle  

u Design  the  API  contract  u Mock  the  API  for  valida>on/collabora>on  u  Test  for  compliance/completeness  u  Build  the  implementa>on  u Deploy  u Manage  

Fast  feedback  loops,  collabora>ve  development  

Page 25: Swagger 2.0: Latest and Greatest

Swagger  Support  for  Design-­‐First  

u  Swagger  always  top-­‐down  capable  u However,  tooling  focused  on  boMom-­‐up      u History  of  fragmented  tool  ecosystem  

Page 26: Swagger 2.0: Latest and Greatest

Introducing  Swagger  Editor  

Page 27: Swagger 2.0: Latest and Greatest

YAML  for  the  Human  

swagger:  '2.0'  info:      version:  1.0.0      >tle:  A  simple  API  paths:      /:          get:              responses:                  200:                      descrip>on:  OK  

Page 28: Swagger 2.0: Latest and Greatest

JSON  for  the  Tools  {      "swagger":  "2.0",      "info":  {          "version":  "1.0.0",          ">tle":  "A  simple  API"      },      "paths":  {          "/":  {              "get":  {                  "responses":  {                      "200":  {                          "descrip>on":  "OK"                      }                  }              }          }      }  }  

Page 29: Swagger 2.0: Latest and Greatest

Swagger  Tools:  Documenta>on  

Swagger  Editor:    Design  your  API  using  simple  YAML  format,  preview.  Requires  the  Node.js  app.  

Swagger  UI:    

Display  your  documenta>on  using  sta>c  HTML  and  client-­‐side  

Javascript.  No  Node.js  required.    

Page 30: Swagger 2.0: Latest and Greatest

Swagger  Tools:  Code  Genera>on  

Page 31: Swagger 2.0: Latest and Greatest

Swagger-­‐Based  Tes>ng  

SoapUI:    Import  and  generate  tests  using  SmartBear’s  SoapUI  tool.  

Runscope:    Import  Swagger  and  generate  run>me  tests  using  Runscope.  

Page 32: Swagger 2.0: Latest and Greatest

Op>on  1:  Hosted  

u  Editor  hMp://editor.swagger.io/  

u Generators  w/  API  hMp://generator.swagger.io/    

Page 33: Swagger 2.0: Latest and Greatest

Op>on  2:  Install  and  Customize  

hMps://github.com/swagger-­‐api/swagger-­‐generator    

hMps://github.com/swagger-­‐api/swagger-­‐editor  

Page 34: Swagger 2.0: Latest and Greatest

Editor  Extensions  

Swagger  Editor  Callbacks:    Callbacks  for  integra>ng  with  design/deploy  workflows.  

Swagger  Editor  Storage:    Backend  support  using  GET  and  PUT  for  retrieving  and  saving  YAML  defini>ons.  

Page 35: Swagger 2.0: Latest and Greatest

How  to  Get  Started  with  Swagger  

u Use  the  Swagger  Editor  to  view  samples  u  In  parallel,  read  the  Swagger  2.0  Spec  to  understand  samples  in-­‐depth  

u  Reverse-­‐engineer  exis>ng  API  or  third-­‐party  API  into  Swagger  

u  Publish  using  Swagger-­‐UI  u  Try  one  of  the  client  code  generators  (some  beMer  than  others)  

Page 36: Swagger 2.0: Latest and Greatest

Thanks  Ya’ll  

 James  Higginbotham  

[email protected]  hMp://launchany.com    

@launchany