SlideShare a Scribd company logo
A tour of Swagger for
(REST) APIs
Allen Dean
Information Development, IBM Watson™
#stc15
Swagger is API
documentation
Right?
© 2015 International Business Machines Corporation 2
Well yes. But, just one of the
tools…
…called Swagger UI
© 2015 International Business Machines Corporation 3
Swagger is a specification…
…for describing a REST API
© 2015 International Business Machines Corporation 4
And Swagger is
a…
…set of core tools
© 2015 International Business Machines Corporation 5
And more
tools…
© 2015 International Business Machines Corporation 6
© 2015 International Business Machines Corporation 7
A robust community
Lots of support…
…through community tools
• Projects by languages:
• Clojure, Go, Java, JavaScript, .Net, Node.js, PERL, PHP, Python,
Ruby..
• Projects by frameworks or platforms:
• Angular.js, Apache (Ant, Maven, Wink), Django, Express, Flask,
Gradle, Grunt, MongoDB, Spring…
• Projects by types
• Servers, clients, converters, generators, parsers, validators…
© 2015 International Business Machines Corporation 8
• A framework that helps to produce and consume APIs
and helps visualize.
• A specification that helps describe and document them.
© 2015 International Business Machines Corporation 9
A technology and a methodology
How do you start?
© 2015 International Business Machines Corporation 10
© 2015 International Business Machines Corporation 11
Decide how to create and
deliver
• Type of output
• Online and hosted: Swagger UI (a JSON object)
• File-based or offline: (HTML, markdown, etc.)
• Method to create Swagger JSON
• Generate from code (annotations)
• Manually: write JSON by hand
• Design and build: Swagger Node
• When to generate from code
• Build regularly
• Create at run time
© 2015 International Business Machines Corporation 12
Type of output
• Online:
• Swagger UI runs in a web browser.
• Not set up for printing or viewing offline
• Static: HTML and other static outputs:
• Swagger codegen
• Generate the Swagger JSON and a simple HTML file
• bootprint-swagger project
• Swagger to HTML
• Swagger2Markup project
• Designed to integrate Swagger generated output with other API
documentation
© 2015 International Business Machines Corporation 13
Decide how to create and
deliver
• Type of output
• Online and hosted: Swagger UI (a JSON object)
• File-based or offline: (HTML, markdown, etc.)
• Method to create Swagger JSON
• Generate from code (annotations)
• Manually: write JSON by hand
• Design and build: Swagger Node
• When to generate from code
• Build regularly
• Create at run time
© 2015 International Business Machines Corporation 14
Write Swagger-compliant
JSON
© 2015 International Business Machines Corporation 15
Manually create with Swagger Editor
© 2015 International Business Machines Corporation 16
Generate from annotations
© 2015 International Business Machines Corporation 17
Add Swagger to an existing API
Find out what Swagger gives you for free: Annotate only your
methods:
@Api() and
@ApiOperation annotations:
© 2015 International Business Machines Corporation 18
Hand-crafted JSON vs.
annotations
• Hand-craft: For when you don’t have access to the code
• Annotations: Easier to maintain. More in sync. Developers
can own or share
• Characteristics:
• Delivered online through the Swagger UI or converted to static
• Generated from annotations or lovingly hand-crafted
• Potential issues with hand crafting
• "Oh the pain" of writing JSON
• Docs in sync only as of last writing
© 2015 International Business Machines Corporation 19
Decide how to create and
deliver
• Type of output
• Online and hosted: Swagger UI (a JSON object)
• File-based or offline: (HTML, markdown, etc.)
• Method to create Swagger JSON
• Generate from code (annotations)
• Manually: write JSON by hand
• Design and build: Swagger Node
• When to generate from code
• Build regularly
• Create at run time
© 2015 International Business Machines Corporation 20
Regularly built JSON
For when you are not ready to generate at run time.
•Characteristics:
• Delivered online through the Swagger UI or converted to static
• Generated from annotations
•Potential issues
• Docs in sync only as of last writing
© 2015 International Business Machines Corporation 21
JSON at run time
Documentation is always in sync with the code
•Characteristics:
• Delivered online through the Swagger UI
• Created from annotations
• Generated at run time
•Potential issues
• Can be technically challenging
Survey of tools and components
© 2015 International Business Machines Corporation 22
• JSON object
• Can use YAML to
construct it
• Version 2 is current
• Swagger UI is backward
compatible with v1.2
© 2015 International Business Machines Corporation 23
Swagger-compliant file
© 2015 International Business Machines Corporation 24
Swagger UI
Can run locally and display hosted
APIs
© 2015 International Business Machines Corporation 25
Swagger Editor
Can view a swagger file without the Swagger UI
© 2015 International Business Machines Corporation 26
Swagger-core annotations
Output is swagger-compliant
© 2015 International Business Machines Corporation 27
Swagger-tools
Showing validation from the CLI
© 2015 International Business Machines Corporation 28
Swagger.ed
A visualization tool
© 2015 International Business Machines Corporation 29
Swagger-ed
Is Swagger for you?
© 2015 International Business Machines Corporation 30
• Can generate reference docs from existing APIs
• Useful in visualizing and testing your API
• Easy to share
• An active community (questions get answered, bugs get
addressed, and features get added)
• Works with a lot of languages, platforms, frameworks
• Open source. Licensed under Apache
• It has an API explorer
© 2015 International Business Machines Corporation 31
Swagger is a good choice
because…
• Your APIs are not good RESTful citizens
• Swagger works best with REST
• Your APIs are complex and Swagger might not be
"expressive" enough
• You don't like the look of the Swagger UI
• Difficult to customize
• It has an API explorer
© 2015 International Business Machines Corporation 32
Swagger is not for you
because…
Where to find out more
Delivered by Swagger
• Swagger website: http://swagger.io/
• Swagger demo:
http://petstore.swagger.io/
• Swagger Editor:
http://editor.swagger.io/
• Swagger Google Group:
https://groups.google.com/forum/#!
forum/swagger-swaggersocket
• GitHub:
https://github.com/swagger-api
From others
• Api Evangelist: Swagger:
http://swagger.apievangelist.com/
• Swagger.ed:
http://chefarchitect.github.io/apispo
ts/swaggered/
• API Description Languages: Which is
the Right One for Me?
http://www.slideshare.net/SOA_Soft
ware/api-description-languages-
which-is-the-right-one-for-me
© 2015 International Business Machines Corporation #stc15 33
Questions
© 2015 International Business Machines Corporation 34

More Related Content

What's hot

Iterative Development with Swagger on the JDK
Iterative Development with Swagger on the JDKIterative Development with Swagger on the JDK
Iterative Development with Swagger on the JDK
Swagger API
 
Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0
Pece Nikolovski
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)
Tony Tam
 
Crystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPICrystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPI
Scott Triglia
 
Implement Web API with Swagger
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with Swagger
Jiang Wu
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...
SmartBear
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
Luigi Saetta
 
Design Driven API Development
Design Driven API DevelopmentDesign Driven API Development
Design Driven API Development
Sokichi Fujita
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014
JWORKS powered by Ordina
 
Get Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI SpecGet Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI Spec
Adam Paxton
 
Swagger
SwaggerSwagger
API Design first with Swagger
API Design first with SwaggerAPI Design first with Swagger
API Design first with Swagger
Tony Tam
 
Swagger code motion talk
Swagger code motion talkSwagger code motion talk
Swagger code motion talk
Victor Trakhtenberg
 
Introducing swagger
Introducing swaggerIntroducing swagger
Introducing swagger
Amr Ali
 
Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
Andrii Gakhov
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
Victor Trakhtenberg
 
Developing Faster with Swagger
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with Swagger
Tony Tam
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
Matt Bishop
 
Advancing Your API Strategy in an Infrastructure World
Advancing Your API Strategy in an Infrastructure WorldAdvancing Your API Strategy in an Infrastructure World
Advancing Your API Strategy in an Infrastructure World
Pronovix
 
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
johannes_fiala
 

What's hot (20)

Iterative Development with Swagger on the JDK
Iterative Development with Swagger on the JDKIterative Development with Swagger on the JDK
Iterative Development with Swagger on the JDK
 
Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)
 
Crystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPICrystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPI
 
Implement Web API with Swagger
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with Swagger
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
 
Design Driven API Development
Design Driven API DevelopmentDesign Driven API Development
Design Driven API Development
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014
 
Get Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI SpecGet Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI Spec
 
Swagger
SwaggerSwagger
Swagger
 
API Design first with Swagger
API Design first with SwaggerAPI Design first with Swagger
API Design first with Swagger
 
Swagger code motion talk
Swagger code motion talkSwagger code motion talk
Swagger code motion talk
 
Introducing swagger
Introducing swaggerIntroducing swagger
Introducing swagger
 
Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
Developing Faster with Swagger
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with Swagger
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
 
Advancing Your API Strategy in an Infrastructure World
Advancing Your API Strategy in an Infrastructure WorldAdvancing Your API Strategy in an Infrastructure World
Advancing Your API Strategy in an Infrastructure World
 
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
 

Viewers also liked

Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing Swagger
Tony Tam
 
Swagger 入門
Swagger 入門Swagger 入門
Swagger 入門
Yoshiaki Yoshida
 
Swaggerで始めるモデルファーストなAPI開発
Swaggerで始めるモデルファーストなAPI開発Swaggerで始めるモデルファーストなAPI開発
Swaggerで始めるモデルファーストなAPI開発
Takuro Sasaki
 
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
johannes_fiala
 
Everybody loves Swagger
Everybody loves SwaggerEverybody loves Swagger
Everybody loves Swagger
BizTalk360
 
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesomeEuroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Metosin Oy
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
Salesforce Developers
 
アプリ開発の境界問題を支えるツール
アプリ開発の境界問題を支えるツールアプリ開発の境界問題を支えるツール
アプリ開発の境界問題を支えるツール
Keishi Hosoba
 
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and SwaggerI Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
Apigee | Google Cloud
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
John Ferguson Smart Limited
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要
Kazuchika Sekiya
 
Create and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and BluemixCreate and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and Bluemix
Dev_Events
 
Workshop Guide: RESTful Java Web Application with Spring Boot
Workshop Guide: RESTful Java Web Application with Spring BootWorkshop Guide: RESTful Java Web Application with Spring Boot
Workshop Guide: RESTful Java Web Application with Spring Boot
Fabricio Epaminondas
 
Swaggerでのapi開発よもやま話
Swaggerでのapi開発よもやま話Swaggerでのapi開発よもやま話
Swaggerでのapi開発よもやま話
KEISUKE KONISHI
 

Viewers also liked (14)

Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing Swagger
 
Swagger 入門
Swagger 入門Swagger 入門
Swagger 入門
 
Swaggerで始めるモデルファーストなAPI開発
Swaggerで始めるモデルファーストなAPI開発Swaggerで始めるモデルファーストなAPI開発
Swaggerで始めるモデルファーストなAPI開発
 
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
 
Everybody loves Swagger
Everybody loves SwaggerEverybody loves Swagger
Everybody loves Swagger
 
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesomeEuroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
 
アプリ開発の境界問題を支えるツール
アプリ開発の境界問題を支えるツールアプリ開発の境界問題を支えるツール
アプリ開発の境界問題を支えるツール
 
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and SwaggerI Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要
 
Create and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and BluemixCreate and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and Bluemix
 
Workshop Guide: RESTful Java Web Application with Spring Boot
Workshop Guide: RESTful Java Web Application with Spring BootWorkshop Guide: RESTful Java Web Application with Spring Boot
Workshop Guide: RESTful Java Web Application with Spring Boot
 
Swaggerでのapi開発よもやま話
Swaggerでのapi開発よもやま話Swaggerでのapi開発よもやま話
Swaggerでのapi開発よもやま話
 

Similar to A Tour of Swagger for APIs

Forge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the BrowserForge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the Browser
Autodesk
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlier
Miroslav Resetar
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
Oracle Developers
 
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft GraphSharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
Sébastien Levert
 
Radu vunvulea building and testing windows 8 metro style applications using ...
Radu vunvulea  building and testing windows 8 metro style applications using ...Radu vunvulea  building and testing windows 8 metro style applications using ...
Radu vunvulea building and testing windows 8 metro style applications using ...
Radu Vunvulea
 
AppNotch Enterprise
AppNotch EnterpriseAppNotch Enterprise
AppNotch Enterprise
appnotch
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
Amazon Web Services
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
PROIDEA
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
Amazon Web Services
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
Heiko Voigt
 
Introduction to Indigo.Design App Builder
Introduction to Indigo.Design App BuilderIntroduction to Indigo.Design App Builder
Introduction to Indigo.Design App Builder
Jason Beres
 
Titanium appcelerator kickstart
Titanium appcelerator kickstartTitanium appcelerator kickstart
Titanium appcelerator kickstart
Alessio Ricco
 
How to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hoursHow to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hours
Oursky
 
How to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hoursHow to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hours
Jane Chung
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
Mark Leusink
 
Low Code Capabilities of Digital Product Design Platforms
Low Code Capabilities of Digital Product Design PlatformsLow Code Capabilities of Digital Product Design Platforms
Low Code Capabilities of Digital Product Design Platforms
JohnMcGuigan10
 
Building the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With YouBuilding the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With You
Nabayan Roy
 
Getting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated TestGetting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated Test
Imaginet
 
Open API Specifications - formerly swagger
Open API Specifications - formerly swaggerOpen API Specifications - formerly swagger
Open API Specifications - formerly swagger
Pradeep Kumar
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Ganesh Kondal
 

Similar to A Tour of Swagger for APIs (20)

Forge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the BrowserForge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the Browser
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlier
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft GraphSharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
SharePoint Fest Chicago - Introduction to AngularJS with the Microsoft Graph
 
Radu vunvulea building and testing windows 8 metro style applications using ...
Radu vunvulea  building and testing windows 8 metro style applications using ...Radu vunvulea  building and testing windows 8 metro style applications using ...
Radu vunvulea building and testing windows 8 metro style applications using ...
 
AppNotch Enterprise
AppNotch EnterpriseAppNotch Enterprise
AppNotch Enterprise
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
 
Introduction to Indigo.Design App Builder
Introduction to Indigo.Design App BuilderIntroduction to Indigo.Design App Builder
Introduction to Indigo.Design App Builder
 
Titanium appcelerator kickstart
Titanium appcelerator kickstartTitanium appcelerator kickstart
Titanium appcelerator kickstart
 
How to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hoursHow to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hours
 
How to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hoursHow to build a Whatsapp clone in 2 hours
How to build a Whatsapp clone in 2 hours
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
 
Low Code Capabilities of Digital Product Design Platforms
Low Code Capabilities of Digital Product Design PlatformsLow Code Capabilities of Digital Product Design Platforms
Low Code Capabilities of Digital Product Design Platforms
 
Building the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With YouBuilding the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With You
 
Getting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated TestGetting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated Test
 
Open API Specifications - formerly swagger
Open API Specifications - formerly swaggerOpen API Specifications - formerly swagger
Open API Specifications - formerly swagger
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

A Tour of Swagger for APIs

  • 1. A tour of Swagger for (REST) APIs Allen Dean Information Development, IBM Watson™ #stc15
  • 2. Swagger is API documentation Right? © 2015 International Business Machines Corporation 2
  • 3. Well yes. But, just one of the tools… …called Swagger UI © 2015 International Business Machines Corporation 3
  • 4. Swagger is a specification… …for describing a REST API © 2015 International Business Machines Corporation 4
  • 5. And Swagger is a… …set of core tools © 2015 International Business Machines Corporation 5
  • 6. And more tools… © 2015 International Business Machines Corporation 6
  • 7. © 2015 International Business Machines Corporation 7 A robust community
  • 8. Lots of support… …through community tools • Projects by languages: • Clojure, Go, Java, JavaScript, .Net, Node.js, PERL, PHP, Python, Ruby.. • Projects by frameworks or platforms: • Angular.js, Apache (Ant, Maven, Wink), Django, Express, Flask, Gradle, Grunt, MongoDB, Spring… • Projects by types • Servers, clients, converters, generators, parsers, validators… © 2015 International Business Machines Corporation 8
  • 9. • A framework that helps to produce and consume APIs and helps visualize. • A specification that helps describe and document them. © 2015 International Business Machines Corporation 9 A technology and a methodology
  • 10. How do you start? © 2015 International Business Machines Corporation 10
  • 11. © 2015 International Business Machines Corporation 11 Decide how to create and deliver • Type of output • Online and hosted: Swagger UI (a JSON object) • File-based or offline: (HTML, markdown, etc.) • Method to create Swagger JSON • Generate from code (annotations) • Manually: write JSON by hand • Design and build: Swagger Node • When to generate from code • Build regularly • Create at run time
  • 12. © 2015 International Business Machines Corporation 12 Type of output • Online: • Swagger UI runs in a web browser. • Not set up for printing or viewing offline • Static: HTML and other static outputs: • Swagger codegen • Generate the Swagger JSON and a simple HTML file • bootprint-swagger project • Swagger to HTML • Swagger2Markup project • Designed to integrate Swagger generated output with other API documentation
  • 13. © 2015 International Business Machines Corporation 13 Decide how to create and deliver • Type of output • Online and hosted: Swagger UI (a JSON object) • File-based or offline: (HTML, markdown, etc.) • Method to create Swagger JSON • Generate from code (annotations) • Manually: write JSON by hand • Design and build: Swagger Node • When to generate from code • Build regularly • Create at run time
  • 14. © 2015 International Business Machines Corporation 14 Write Swagger-compliant JSON
  • 15. © 2015 International Business Machines Corporation 15 Manually create with Swagger Editor
  • 16. © 2015 International Business Machines Corporation 16 Generate from annotations
  • 17. © 2015 International Business Machines Corporation 17 Add Swagger to an existing API Find out what Swagger gives you for free: Annotate only your methods: @Api() and @ApiOperation annotations:
  • 18. © 2015 International Business Machines Corporation 18 Hand-crafted JSON vs. annotations • Hand-craft: For when you don’t have access to the code • Annotations: Easier to maintain. More in sync. Developers can own or share • Characteristics: • Delivered online through the Swagger UI or converted to static • Generated from annotations or lovingly hand-crafted • Potential issues with hand crafting • "Oh the pain" of writing JSON • Docs in sync only as of last writing
  • 19. © 2015 International Business Machines Corporation 19 Decide how to create and deliver • Type of output • Online and hosted: Swagger UI (a JSON object) • File-based or offline: (HTML, markdown, etc.) • Method to create Swagger JSON • Generate from code (annotations) • Manually: write JSON by hand • Design and build: Swagger Node • When to generate from code • Build regularly • Create at run time
  • 20. © 2015 International Business Machines Corporation 20 Regularly built JSON For when you are not ready to generate at run time. •Characteristics: • Delivered online through the Swagger UI or converted to static • Generated from annotations •Potential issues • Docs in sync only as of last writing
  • 21. © 2015 International Business Machines Corporation 21 JSON at run time Documentation is always in sync with the code •Characteristics: • Delivered online through the Swagger UI • Created from annotations • Generated at run time •Potential issues • Can be technically challenging
  • 22. Survey of tools and components © 2015 International Business Machines Corporation 22
  • 23. • JSON object • Can use YAML to construct it • Version 2 is current • Swagger UI is backward compatible with v1.2 © 2015 International Business Machines Corporation 23 Swagger-compliant file
  • 24. © 2015 International Business Machines Corporation 24 Swagger UI Can run locally and display hosted APIs
  • 25. © 2015 International Business Machines Corporation 25 Swagger Editor Can view a swagger file without the Swagger UI
  • 26. © 2015 International Business Machines Corporation 26 Swagger-core annotations Output is swagger-compliant
  • 27. © 2015 International Business Machines Corporation 27 Swagger-tools Showing validation from the CLI
  • 28. © 2015 International Business Machines Corporation 28 Swagger.ed A visualization tool
  • 29. © 2015 International Business Machines Corporation 29 Swagger-ed
  • 30. Is Swagger for you? © 2015 International Business Machines Corporation 30
  • 31. • Can generate reference docs from existing APIs • Useful in visualizing and testing your API • Easy to share • An active community (questions get answered, bugs get addressed, and features get added) • Works with a lot of languages, platforms, frameworks • Open source. Licensed under Apache • It has an API explorer © 2015 International Business Machines Corporation 31 Swagger is a good choice because…
  • 32. • Your APIs are not good RESTful citizens • Swagger works best with REST • Your APIs are complex and Swagger might not be "expressive" enough • You don't like the look of the Swagger UI • Difficult to customize • It has an API explorer © 2015 International Business Machines Corporation 32 Swagger is not for you because…
  • 33. Where to find out more Delivered by Swagger • Swagger website: http://swagger.io/ • Swagger demo: http://petstore.swagger.io/ • Swagger Editor: http://editor.swagger.io/ • Swagger Google Group: https://groups.google.com/forum/#! forum/swagger-swaggersocket • GitHub: https://github.com/swagger-api From others • Api Evangelist: Swagger: http://swagger.apievangelist.com/ • Swagger.ed: http://chefarchitect.github.io/apispo ts/swaggered/ • API Description Languages: Which is the Right One for Me? http://www.slideshare.net/SOA_Soft ware/api-description-languages- which-is-the-right-one-for-me © 2015 International Business Machines Corporation #stc15 33
  • 34. Questions © 2015 International Business Machines Corporation 34

Editor's Notes

  1. Titles I thought about using: Help! My developers are using Swagger. Now what? What the heck is Swagger and why do I care? And you thought Swagger was an API doc tool... About me With IBM for 9 years, IBM Watson for 2. Watson was formed from the technology that was showcased on Jeopardy! In 2011. Before that, 10 years with tech startups. One right here: fourthchannel. Oh, and spent my elementary school years here back when Woody Hayes was in charge of the city. I really wanted to be the drum major for the marching band. If this doesn't make sense, I can't explain. Watson is focused on APIs and services. Over a dozen Watson services in the Watson Developer Cloud in the last year. The focus has driven some work around how we deliver the docs and what those docs are. No Eclipse info center or knowledge center. Me and Swagger: I learned about Swagger from one of my development teams. We were surveying how to provide an internal API explorer. We had hundreds of undocumented APIs and the dev team was sick of answering questions. We picked Swagger and I jumped on board. We retrofitted Swagger in those multi hundred APIs and I learned a lot about the process. Focus: In this presentation, I focus on the output of describing a REST API with Swagger. I'm not discussing various developer-centric topics, such as hooking Swagger up to your existing code, running Swagger, or generating servers or clients. What might be helpful to know about Swagger as an information developer so you can discuss it and use it.
  2. If you have seen Swagger, you're probably familiar with this look. And this IS Swagger to many people.
  3. But Swagger Swagger is more than this. This is the Swagger UI, the standard visualization of an API described by Swagger. And this is what most people think of when they hear Swagger. It's true that Swagger did start as a way for one company to help document their APIs. But Swagger is more than this visualization.
  4. Swagger is a definition language. A standard to help describe REST APIs for both humans and machines to understand. We're looking at a screenshot of the root specification for Swagger. The rules that Swagger tools understand. As information developers or content folks, we are often most interested in generating documentation and visualizations of the API so that humans can understand it. But because this has a structure can be used to validate a description, Swagger can be used throughout many parts of the lifecycle of a REST API.
  5. But there's more! Besides the Swagger UI, which you might see here, there are other tools that follow the spec and can be used with Swagger. Tools to help integrating swagger with code, and to help design and visualize APIs at the same time.
  6. And there are more tools to help create clients and servers Node express is now called Swagger node: GitHub: "tools for designing and building Swagger-compliant APIs entirely in Node.js." Parser: API Evangelist: "Parses a machine readable API definition and makes ready for use in specific language, structure, or platform."
  7. And Swagger has an active community on Google groups, an IRC channel, StackOverflow, and GitHub. The community answers questions from both developers and others. And they do suffer fools.
  8. You can write APIs in many languages and use in many frameworks. Swagger has support for many of them
  9. So, Swagger is both a technology and a methodology. The methodology is precise and consistent and allows the technology to work with it, often in automated ways (for example, creating clients and servers, supporting API explorers). Supports both bottom-up and top-down approaches. Can be part of much of the lifecycle of an API. Top down: help design and api, then create the code as well as produce documentation. Bottom up: Take existing API and add swagger annotations or create Swagger files separately. Lifecycle support: Design, Code, Text, Document.
  10. specific ways to think about putting this together for your set of APIs.
  11. Three things to think about: What kind of output do you want? Swagger UI runs online How are you going to get that Swagger file? And when to you generate that file?
  12. First up: what kind of output? We've seen the swagger UI. But what do you do when you want to hand the docs to someone who doesn't have access to the UI? What if you want to print? Then you have to look at other tools – some that come from Swagger and some from the community. Point is that creating these docs takes some additional work. Swagger codegen: A template-driven engine to generate client code in different languages by parsing your Swagger documentation. Not too familiar with bootprint-swagger Swagger2Markup converts a Swagger JSON or YAML file into AsciiDoc or Markdown documents which can be combined with hand-written documentation. The AsciiDoc documents can be converted into HTML5, PDF and EPUB. The Swagger2MarkupConverter supports the Swagger 1.2 and 2.0 specification. ID participation: you know the requirements for output.
  13. We've touched on how you create the Swagger file: by hand, including with the Swagger Editor, and with annotations
  14. Some of us love to code HTML by hand. Some to write DITA by hand. If you do, you'll love writing JSON by hand. Issues: how do you know that the JSON is valid? Use a good text editor, validate the JSON schema, use swagger-tools to validate semantically. Top down approach? This is design first – code flow from this Bottom up approach: Already have the API – add the Swagger descriptions to it.
  15. Hand crafting by using the Editor. Get validation for free. Although somewhat painful. Top down approach? This is design first – code flow from this You can also use the editor with Swagger Node to create the code as you design it. More for the developer in you.
  16. Annotations: generating Swagger output from your code. Has technical implications, but a good goal because it's easier to maintain and in synch. Bottom up approach: Already have the API – add the Swagger descriptions to it.
  17. JAX-RS annotations in red / Swagger annotations in blue You have to be comfortable reading the code, understanding a bit of what's going on. What's being sent. What's being returned. Our developers were very helpful getting me to a deeper understanding of how they put the APIs together. 2 Swagger annotations are required for Swagger to recognize an API: @Api for the resource (set of APIs) and @ApiOperation for the method (GET, POST, PUT, DELETE, etc.). Other annotations add details to the documentation. JAX-RS based applications can pull info from the basic @XxxxParam annotations (@QueryParam, @PathParam...), although you can override these
  18. May run some build process to generate JSON files served up to the web server - at which point you are still Annotation-based. Can also hand-code JSON - which seems like a terrifying commitment long term.
  19. This is a normal process for us with docs: write something, build or transform it, then deliver it (print/FTP it/copy files etc.) May run some build process to generate JSON files served up to the web server - at which point you are still Annotation-based.
  20. The ultimate in being in synch. Note that this is delivered through the Swagger UI, not offline. "Technically challenging" is an understatement. We did this with our first Swagger project. Was quite popular. But we had to caution users (internal) not to hang themselves by trying out delete operations, for example.
  21. Let's go through some parts of Swagger that you might use in documenting a REST API.
  22. We showed the JSON behind the Swagger UI. From the spec, "The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to represent a Swagger specification file." This is the JSON object. There is an excellent walkthrough of the swagger spec on the API Evangelist site: swagger.apievangelist.com. Have a link at the end of the presentation. The current Swagger UI can display both v2 and v1 compatible files, but not at the same time. V2 takes the form of a a single file and v1 is multiple files, so can't co-exist You can write this JSON.
  23. Common way to view Swagger-compliant JSON Standard visualization You can run the Swagger UI locally and display APIs that are hosted. You can host the Swagger UI Possible use for ID: own this!
  24. We also demoed this. Another way to view Swagger-compliant JSON Nice thing about the editor is that it's a quick way to view a swagger file without having access to the Swagger UI. Works with YAML. Accepts and saves JSON and YAML YAML is a recursive acronym: YAML Ain't Markup Language. From Wikipedia: Early in its development, YAML was said to mean "Yet Another Markup Language",[3] but it was then reinterpreted (backronyming the original acronym) to distinguish its purpose as data-oriented, rather than document markup. Designed to be easier for us humans to read and interpret. (Easier than JSON) Run online or locally (For example with Swagger Node) Possible use for ID: Update existing manually create specs. Take a different description (word doc) and write it up here)
  25. This is swagger in your code. The output of this is swagger-compliant and can be used in the Swagger UI This is a set of annotations to declare and manipulate the output. You don't need to know all about the Swagger spec, but you can use it as reference.
  26. Swagger is a spec. With this set of tools, you can check whether your JSON complies with the spec CLI Convert a file from v1 to v2 Validate a file: find errors and warnings. (Also possible in the editor). Showing this on screen. starts all Swagger document validation using the JSON Schema file(s). Once that validation passes, goes through each pertinent semantic validation. Possible use for ID: I often use this to help various teams validate their swagger – especially if they're creating by hand. Because I know the spec, I can help them describe their API while they focus on designing and coding.
  27. Have fun with visualization. This one is called Swagger.ed. Just an example of how different visualizations can be written against the same swagger-compliant files. Has a chrome extension
  28. Can zoom in and out Here I double-clicked on the pet path and can inspect the resource in a different visualization. Possible use for ID: review APIs for inconsistencies. Help teams visualize the catalog.
  29. Just a couple more slides
  30. Not only can you design APIs with swagger, you can add it to existing APIs. This is what we did in our first project. The Swagger UI can be excellent for finding inconsistencies and errors For example, once in Swagger, we noticed that identical parameters in different operations were different data types. One was a string, another an integer for the same thing. Also saw how inconsistent our resources endpoints were: mix of nouns and verbs. Mix of plurals and singulars Because it's a spec, you can share the description easily. If I give you a swagger-compliant file, you can load it in your swagger tool Lots of people are actively working on Swagger, both from a community standpoint and from a code standpoint Issues with commercial software? This is open source Has a great API explorer
  31. If your API endpoints aren't resources but actions. Lots of info crammed into a body request. Developers can get creative with APIs. Some are difficult to show. For example, showing that a query param could have value x or y, or z. Just recently supported. I work with people who don't like the look of Swagger UI. Think it's good as an API explorer, but not so good for reference. To modify the UI is tough, from what I understand. However, because it's a spec, you might be able to create your own visualization (think swagger.ed) Initial reactions were "cool!" Reactions from developers learning APIs has been mixed: "I like some other treatments better" Being cool is important. The "Try it" button has security implications. Some people also don't want it with their reference. Of course, you can always hide it.
  32. Show POC if have time: using docpad. Pull data from several sources and integrate