SlideShare una empresa de Scribd logo
1 de 16
Swagger
Martin Yung
17 avril 2015
Objectifs
 Rappels sur les notions
 REST
 API
 Présentation de la norme Swagger
 Outils
La valeur d'un objet bien conçu : c’est quand il y a un ensemble riche de
capacités que les personnes qui l'utilisent peuvent faire des choses que
le concepteur n'a jamais imaginé. par Don Norman
The value of a well designed object is when it has such a rich set of affordances
that the people who use it could do things that the designer never imagined.
REST
 = Representational state transfer
 Architecture Client-serveur
 Sans état (stateless)
 Avantage
 Respecte le standard HTTP (verbes : GET, POST…)
 Plus simple, moins verbose que SOAP
API REST
 = Application Programming Interface
 Contrat de service
 Formats de messages
 XML
 JSON
 Exemple
 USA.gov
 Supporté par
 APIgee
 Microsoft Azure API Management
Qu’est-ce que Swagger ?
 Grammaire JSON/YAML
 Décrit une API REST
 Equivalent de WSDL pour REST
 Technologies supportées : .NET, Java, NodeJS…
 Alternatives
 Aucun standard s’impose
 WADL (Web Application Description Language)
 Soumis à W3C par SUN mais non standardisé
Swagger 2.0
 Sortie en septembre 2014
 Supporte Markdown
 Un seul fichier : swagger.json par défaut
Comment utiliser ?
 API First
 Utiliser un éditeur Swagger
 Générer la documentation en HTML
 Code First (.NET)
 Ecrire les codes pour les controllers et modèles de vue (design pattern
MVVM)
 Utiliser le nuget Swashbuckle
swagger-editor
swagger-to-html
Swashbuckle
Comment décrire un endpoint
 Path
 /api/parametre/titre/descriptif
 {get/post}
 description
 parameters
 responses
 200
 404
Comment décrire un paramètre /
une réponse
 parameters
 name
 in
 description
 schema
 type
 properties
 produit
 type : object
 valeurFaciale
 …
Ce que nous avons vu
 Décrire les endpoints avec la norme Swagger
 Utiliser les outils
 swagger-editor
 swagger-to-html
 Swashbuckle
Resources
 https://github.com/swagger-api/swagger-
spec/blob/master/versions/2.0.md
 https://www.nuget.org/packages/swashbuckle
Merci 

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
React hooks
React hooksReact hooks
React hooks
 
Support cours angular
Support cours angularSupport cours angular
Support cours angular
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
REST API
REST APIREST API
REST API
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
Introduction à Angular
Introduction à AngularIntroduction à Angular
Introduction à Angular
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Angular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHTAngular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHT
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Angular
AngularAngular
Angular
 
Formation jpa-hibernate-spring-data
Formation jpa-hibernate-spring-dataFormation jpa-hibernate-spring-data
Formation jpa-hibernate-spring-data
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
Faq receiving returns and corrections document Oracle apps
Faq receiving returns and corrections  document Oracle apps Faq receiving returns and corrections  document Oracle apps
Faq receiving returns and corrections document Oracle apps
 
ReactJs
ReactJsReactJs
ReactJs
 
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
 

Similar a Swagger pour documenter votre REST API - présentation en français

20140130 mug lyon - post-mortem d'une application métier
20140130   mug lyon - post-mortem d'une application métier20140130   mug lyon - post-mortem d'une application métier
20140130 mug lyon - post-mortem d'une application métier
Matthieu DUFOURNEAUD
 
Android fundamentals and communication with Java EE Application
Android fundamentals and communication with Java EE ApplicationAndroid fundamentals and communication with Java EE Application
Android fundamentals and communication with Java EE Application
Adil Ourida
 

Similar a Swagger pour documenter votre REST API - présentation en français (20)

Le design d'API avec Mulesoft
Le design d'API avec MulesoftLe design d'API avec Mulesoft
Le design d'API avec Mulesoft
 
GtugDakar AppEngine, Gwt
GtugDakar AppEngine, GwtGtugDakar AppEngine, Gwt
GtugDakar AppEngine, Gwt
 
JavaScript aussi sur le serveur et jusque dans le cloud?
JavaScript aussi sur le serveur et jusque dans le cloud?JavaScript aussi sur le serveur et jusque dans le cloud?
JavaScript aussi sur le serveur et jusque dans le cloud?
 
Parisweb - javascript server side - par où commencer ?
Parisweb - javascript server side - par où commencer ?Parisweb - javascript server side - par où commencer ?
Parisweb - javascript server side - par où commencer ?
 
Server Side Javascript in the cloud
Server Side Javascript in the cloudServer Side Javascript in the cloud
Server Side Javascript in the cloud
 
JavaScript aussi sur le serveur et jusque dans le cloud?
JavaScript aussi sur le serveur et jusque dans le cloud?JavaScript aussi sur le serveur et jusque dans le cloud?
JavaScript aussi sur le serveur et jusque dans le cloud?
 
De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)
 
Bbl microservices avec vert.x cdi elastic search
Bbl microservices avec vert.x cdi elastic searchBbl microservices avec vert.x cdi elastic search
Bbl microservices avec vert.x cdi elastic search
 
Recruter et travailler avec un développeur
Recruter et travailler avec un développeurRecruter et travailler avec un développeur
Recruter et travailler avec un développeur
 
Comprendre, utiliser et créer une API
Comprendre, utiliser et créer une APIComprendre, utiliser et créer une API
Comprendre, utiliser et créer une API
 
API : l'architecture REST
API : l'architecture RESTAPI : l'architecture REST
API : l'architecture REST
 
20140130 mug lyon - post-mortem d'une application métier
20140130   mug lyon - post-mortem d'une application métier20140130   mug lyon - post-mortem d'une application métier
20140130 mug lyon - post-mortem d'une application métier
 
Web services SOAP et REST
Web services  SOAP et RESTWeb services  SOAP et REST
Web services SOAP et REST
 
Azure Api management
Azure Api managementAzure Api management
Azure Api management
 
DevCon 3 : Azure API Management
DevCon 3 : Azure API ManagementDevCon 3 : Azure API Management
DevCon 3 : Azure API Management
 
Android fundamentals and communication with Java EE Application
Android fundamentals and communication with Java EE ApplicationAndroid fundamentals and communication with Java EE Application
Android fundamentals and communication with Java EE Application
 
APIs dans Azure : serverless ou pas serverless?
APIs dans Azure : serverless ou pas serverless?APIs dans Azure : serverless ou pas serverless?
APIs dans Azure : serverless ou pas serverless?
 
Alt.Net France - Domain Driven Design - 2 Dec 2008
Alt.Net France - Domain Driven Design - 2 Dec 2008Alt.Net France - Domain Driven Design - 2 Dec 2008
Alt.Net France - Domain Driven Design - 2 Dec 2008
 
Présentation Rex GWT 2.0
Présentation Rex GWT 2.0Présentation Rex GWT 2.0
Présentation Rex GWT 2.0
 
Le Web comme plateforme applicative - comment programme-t-on le Web?
Le Web comme plateforme applicative - comment programme-t-on le Web?Le Web comme plateforme applicative - comment programme-t-on le Web?
Le Web comme plateforme applicative - comment programme-t-on le Web?
 

Swagger pour documenter votre REST API - présentation en français

  • 2. Objectifs  Rappels sur les notions  REST  API  Présentation de la norme Swagger  Outils
  • 3. La valeur d'un objet bien conçu : c’est quand il y a un ensemble riche de capacités que les personnes qui l'utilisent peuvent faire des choses que le concepteur n'a jamais imaginé. par Don Norman The value of a well designed object is when it has such a rich set of affordances that the people who use it could do things that the designer never imagined.
  • 4. REST  = Representational state transfer  Architecture Client-serveur  Sans état (stateless)  Avantage  Respecte le standard HTTP (verbes : GET, POST…)  Plus simple, moins verbose que SOAP
  • 5. API REST  = Application Programming Interface  Contrat de service  Formats de messages  XML  JSON  Exemple  USA.gov  Supporté par  APIgee  Microsoft Azure API Management
  • 6. Qu’est-ce que Swagger ?  Grammaire JSON/YAML  Décrit une API REST  Equivalent de WSDL pour REST  Technologies supportées : .NET, Java, NodeJS…  Alternatives  Aucun standard s’impose  WADL (Web Application Description Language)  Soumis à W3C par SUN mais non standardisé
  • 7. Swagger 2.0  Sortie en septembre 2014  Supporte Markdown  Un seul fichier : swagger.json par défaut
  • 8. Comment utiliser ?  API First  Utiliser un éditeur Swagger  Générer la documentation en HTML  Code First (.NET)  Ecrire les codes pour les controllers et modèles de vue (design pattern MVVM)  Utiliser le nuget Swashbuckle
  • 12. Comment décrire un endpoint  Path  /api/parametre/titre/descriptif  {get/post}  description  parameters  responses  200  404
  • 13. Comment décrire un paramètre / une réponse  parameters  name  in  description  schema  type  properties  produit  type : object  valeurFaciale  …
  • 14. Ce que nous avons vu  Décrire les endpoints avec la norme Swagger  Utiliser les outils  swagger-editor  swagger-to-html  Swashbuckle

Notas del editor

  1. Donald Arthur "Don" Norman (born December 25, 1935) is the director of The Design Lab at University of California, San Diego (cf http://en.wikipedia.org/wiki/Don_Norman)
  2. http://www.usa.gov/About/developer-resources/federal-agency-directory/interactivedoc.shtml#!/contacts Séparation de responsabilité Front : HTML, CSS, JavaScript (AngularJS) Back : .NET, NodeJS, PHP http://azure.microsoft.com/en-us/documentation/articles/api-management-howto-import-api/
  3. https://github.com/swagger-api/swagger-spec/tree/master/versions
  4. swagger-to-html : https://www.npmjs.com/package/swagger-to-html Swashbuckle : https://www.nuget.org/packages/swashbuckle
  5. Installer NodeJS Lancer dans l’invité de commande : git clone https://github.com/swagger-api/swagger-editor.git cd swagger-editor npm start
  6. Installer NodeJS Lancer dans l’invité de commande : npm install –g swagger-to-html swagger-to-html swagger.json c:\output