SlideShare a Scribd company logo
1 of 10
Adding Swagger to your API
Joe Conley
What is Swagger?
A schema to define your API in JSON format
That‘s it!
Why Swagger?
The nice folks at Swagger have created some fancy tools
based on your API‘s JSON schema.
Swagger UI – LIVE and INTERACTIVE documentation
based on your schema
Swagger Editor – Use a live YAML editor to build your
schema
Swagger Codegen – dozens of libraries for different
languages will generate code stubs based on your
schema
Plus an entire ecosystem of tools which will help you
generate your API schema
Demo – C.U.B.E., Upsell Reporting
TODO: Make More Programmatic
As of now the CUBE JSON was mostly handwritten, with a simple
Handlebars converter to insert values from the config.
Ideally we‘d like to build a library that‘s minimally invasive to our code but
powerful enough to detect the structure of our API, and still let us add
metadata like plaintext descriptions.
Possible Solutions
- Annotations? It‘s a nightmare in Play.
- Reflection?
- Macros?
Aside: Syncing with Postman
I get the sense some people here use Postman? Me too!
Swagger UI is nice for some basic testing and operations, but
if you need to have greater control over your HTTP requests or
quickly switch environments, Swagger UI won‘t cut it.
But it‘d still be nice to stay in sync with our JSON API schema.
Well it turns out that Postman stores their collection information
in JSON as well
So…..
Shameless plug: swagger2postman
Simple transformation of a Swagger JSON API schema into a
Postman collection.
I ran into this problem with a previous client. It‘s a simple Scala
program which converts valid Swagger 1.2/2.0 JSON spec and
returns a valid Postman collection in JSON that you can import
directly into Postman.
Note: Postman has an import from Swagger function, but (at the
time I wrote this) it wasn‘t very good.
Github: https://github.com/josephpconley/swagger2postman
App: http://app.josephpconley.com/swagger2postman
TODO automate this?
Discuss: Standardize on Swagger?
I‘ll admit I was surprised none of the APIs had some form of
standard documentation.
Would it be valuable get all the APIs we use on some basic Swagger
documentation? At least the V2 Resource servers?
Would make easier onboarding of new devs!
Requires additional effort to maintain regardless of how it‘s
implemented
Could also lead to other optimizations too. I worked on an API test
framework for a client built using JSON specs, we could conceivably
automate the integration testing of an API with help from the
Swagger Spec
Questions? Comments?
Questions? Comments?

More Related Content

What's hot

What's hot (20)

Event Machine
Event MachineEvent Machine
Event Machine
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
 
Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013
 
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 AugustJets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 August
 
Load test REST APIs using gatling
Load test REST APIs using gatlingLoad test REST APIs using gatling
Load test REST APIs using gatling
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascript
 
Continuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksContinuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorks
 
Gatling - Stress test tool
Gatling - Stress test toolGatling - Stress test tool
Gatling - Stress test tool
 
Background processes and tasks in an async world
Background processes and tasks in an async worldBackground processes and tasks in an async world
Background processes and tasks in an async world
 
RxJS - The Basics & The Future
RxJS - The Basics & The FutureRxJS - The Basics & The Future
RxJS - The Basics & The Future
 
Grape golilath
Grape golilathGrape golilath
Grape golilath
 
Ruby vs Node ShiningRay Shanghai
Ruby vs Node ShiningRay ShanghaiRuby vs Node ShiningRay Shanghai
Ruby vs Node ShiningRay Shanghai
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor Programming
 
Performance
PerformancePerformance
Performance
 
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 AprilJets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
 
True Confessions of Host named site collections in SharePoint 2013
True Confessions of Host named site collections in SharePoint 2013True Confessions of Host named site collections in SharePoint 2013
True Confessions of Host named site collections in SharePoint 2013
 
Lambda lambda-lambda
Lambda lambda-lambdaLambda lambda-lambda
Lambda lambda-lambda
 
Custom Mongrel Handlers: Learning how to walk the dog
Custom Mongrel Handlers: Learning how to walk the dogCustom Mongrel Handlers: Learning how to walk the dog
Custom Mongrel Handlers: Learning how to walk the dog
 
Leveraging Micronaut on AWS Lambda
Leveraging Micronaut on AWS LambdaLeveraging Micronaut on AWS Lambda
Leveraging Micronaut on AWS Lambda
 

Viewers also liked

Nora Eziani, Marina, Andreina
Nora Eziani, Marina, AndreinaNora Eziani, Marina, Andreina
Nora Eziani, Marina, Andreina
noriis99
 
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
Waqas Tariq
 
EducationalPhilosophyBethPage
EducationalPhilosophyBethPageEducationalPhilosophyBethPage
EducationalPhilosophyBethPage
Beth Page
 

Viewers also liked (20)

POPcomms Portfolio
POPcomms PortfolioPOPcomms Portfolio
POPcomms Portfolio
 
Ii
IiIi
Ii
 
Справка по выполнению Плана обеспечения устойчивого развития экономики и соци...
Справка по выполнению Плана обеспечения устойчивого развития экономики и соци...Справка по выполнению Плана обеспечения устойчивого развития экономики и соци...
Справка по выполнению Плана обеспечения устойчивого развития экономики и соци...
 
Limites infinitos
Limites infinitosLimites infinitos
Limites infinitos
 
My lungs 1- 2
My lungs 1- 2My lungs 1- 2
My lungs 1- 2
 
Funciones
FuncionesFunciones
Funciones
 
Nora Eziani, Marina, Andreina
Nora Eziani, Marina, AndreinaNora Eziani, Marina, Andreina
Nora Eziani, Marina, Andreina
 
Costumes props and equipment
Costumes props and equipmentCostumes props and equipment
Costumes props and equipment
 
VMware on IBM Cloud 웨비나 발표자료 입니다.
VMware on IBM Cloud 웨비나 발표자료 입니다.VMware on IBM Cloud 웨비나 발표자료 입니다.
VMware on IBM Cloud 웨비나 발표자료 입니다.
 
Liquid Oxygen Nitrogen Plants of Better Deal Machineries Pvt. Ltd.
Liquid Oxygen Nitrogen Plants of Better Deal Machineries Pvt. Ltd. Liquid Oxygen Nitrogen Plants of Better Deal Machineries Pvt. Ltd.
Liquid Oxygen Nitrogen Plants of Better Deal Machineries Pvt. Ltd.
 
Gcf nap malawi27feb
Gcf nap malawi27febGcf nap malawi27feb
Gcf nap malawi27feb
 
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
Evaluation Performance of 2nd Order Nonlinear System: Baseline Control Tunabl...
 
EducationalPhilosophyBethPage
EducationalPhilosophyBethPageEducationalPhilosophyBethPage
EducationalPhilosophyBethPage
 
Build Swagger definition - Sample
Build Swagger definition - SampleBuild Swagger definition - Sample
Build Swagger definition - Sample
 
Swagger for-your-api
Swagger for-your-apiSwagger for-your-api
Swagger for-your-api
 
Swaggerを利用した新規サービス開発
Swaggerを利用した新規サービス開発Swaggerを利用した新規サービス開発
Swaggerを利用した新規サービス開発
 
Understanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its tools
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要
 
Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
 

Similar to Swagger demo

Similar to Swagger demo (20)

End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
AngularJS2 / TypeScript / CLI
AngularJS2 / TypeScript / CLIAngularJS2 / TypeScript / CLI
AngularJS2 / TypeScript / CLI
 
Isomorphic Server/Client Ruby with Opal
Isomorphic Server/Client Ruby with OpalIsomorphic Server/Client Ruby with Opal
Isomorphic Server/Client Ruby with Opal
 
HealthyCodeMay2014
HealthyCodeMay2014HealthyCodeMay2014
HealthyCodeMay2014
 
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerE2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
 
Jcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applicationsJcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applications
 
Skinny Framework Progress Situation
Skinny Framework Progress SituationSkinny Framework Progress Situation
Skinny Framework Progress Situation
 
NodeJS @ ACS
NodeJS @ ACSNodeJS @ ACS
NodeJS @ ACS
 
Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...
Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...
Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api's
 
Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps
 
Hacking Real time Messaging with Firebase
Hacking Real time Messaging with FirebaseHacking Real time Messaging with Firebase
Hacking Real time Messaging with Firebase
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinItb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin Pickin
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product Developers
 
Building APIs using Laravel - A simple approach to scale
Building APIs using Laravel - A simple approach to scaleBuilding APIs using Laravel - A simple approach to scale
Building APIs using Laravel - A simple approach to scale
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
Developing for the GeoWeb: Notes From The Field Dev Summit 2009
Developing for the GeoWeb: Notes From The Field Dev Summit 2009Developing for the GeoWeb: Notes From The Field Dev Summit 2009
Developing for the GeoWeb: Notes From The Field Dev Summit 2009
 
A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)
 
Swagger UI
Swagger UISwagger UI
Swagger UI
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Swagger demo

  • 1. Adding Swagger to your API Joe Conley
  • 2. What is Swagger? A schema to define your API in JSON format That‘s it!
  • 3. Why Swagger? The nice folks at Swagger have created some fancy tools based on your API‘s JSON schema. Swagger UI – LIVE and INTERACTIVE documentation based on your schema Swagger Editor – Use a live YAML editor to build your schema Swagger Codegen – dozens of libraries for different languages will generate code stubs based on your schema Plus an entire ecosystem of tools which will help you generate your API schema
  • 4. Demo – C.U.B.E., Upsell Reporting
  • 5. TODO: Make More Programmatic As of now the CUBE JSON was mostly handwritten, with a simple Handlebars converter to insert values from the config. Ideally we‘d like to build a library that‘s minimally invasive to our code but powerful enough to detect the structure of our API, and still let us add metadata like plaintext descriptions. Possible Solutions - Annotations? It‘s a nightmare in Play. - Reflection? - Macros?
  • 6. Aside: Syncing with Postman I get the sense some people here use Postman? Me too! Swagger UI is nice for some basic testing and operations, but if you need to have greater control over your HTTP requests or quickly switch environments, Swagger UI won‘t cut it. But it‘d still be nice to stay in sync with our JSON API schema. Well it turns out that Postman stores their collection information in JSON as well So…..
  • 7. Shameless plug: swagger2postman Simple transformation of a Swagger JSON API schema into a Postman collection. I ran into this problem with a previous client. It‘s a simple Scala program which converts valid Swagger 1.2/2.0 JSON spec and returns a valid Postman collection in JSON that you can import directly into Postman. Note: Postman has an import from Swagger function, but (at the time I wrote this) it wasn‘t very good. Github: https://github.com/josephpconley/swagger2postman App: http://app.josephpconley.com/swagger2postman TODO automate this?
  • 8. Discuss: Standardize on Swagger? I‘ll admit I was surprised none of the APIs had some form of standard documentation. Would it be valuable get all the APIs we use on some basic Swagger documentation? At least the V2 Resource servers? Would make easier onboarding of new devs! Requires additional effort to maintain regardless of how it‘s implemented Could also lead to other optimizations too. I worked on an API test framework for a client built using JSON specs, we could conceivably automate the integration testing of an API with help from the Swagger Spec