Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Swagger code motion talk

865 Aufrufe

Veröffentlicht am

A talk given at Code Motion Tel-Aviv

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Swagger code motion talk

  1. 1. Swagger Make your API accessible Victor Trakhtenberg victortr75@gmail.com @victortr75
  2. 2. Personal My name is Victor
  3. 3. Personal Java.IL community co-­‐founder http://www.meetup.com/JavaIL/
  4. 4. Personal Full Stack Engineer @
  5. 5. http://vatuma.com/demo/wp-content/uploads/2009/11/sun.jpg
  6. 6. http://toonclips.com/design/828
  7. 7. hFp://www.appdynamics.com/blog/wp-­‐content/uploads/2012/11/producMonCraziness2.png
  8. 8. http://thehandcraPedstory.com/wp-content/uploads/2014/08/we-all-have-a-story-to-tell.jpg
  9. 9. Architecture Monolith to Micro Services APIs hFps://twiFer.com/dcorpa
  10. 10. Architecture APIs are for humans DocumentaMon hFp://www.infoq.com/resource/presentaMons/API-­‐Humans/en/slides/sl23.jpg
  11. 11. DocumentaMon
  12. 12. DocumentaMon • No standard • Ad-­‐hoc aFributes • Managed manually • Not up to date • ….. hFp://www.imagineyourreality.com/business-­‐coaching/documentaMon.html
  13. 13. API LisMng
  14. 14. API OperaMons
  15. 15. API parameters and return types
  16. 16. Swagger is… Technology Methodology A framework for • producing • consuming • visualizing RESTful APIs A specificaMon for • describing • documenMng RESTful APIs
  17. 17. The Swagger SpecificaMon It’s a spec! • JSON to specify metadata • JSON to specify API structure • JSON schema for the model specificaMon • Machine readable • Language agnosMc
  18. 18. Agenda • IntroducMon • Deep Dive • The technology • Swagger is not • Swagger 2.0 • AlternaMves • References
  19. 19. Deep Dive
  20. 20. Swagger -­‐ API LisMng
  21. 21. Swagger -­‐ API LisMng -­‐ JSON
  22. 22. Swagger – API LisMng -­‐ AnnotaMons
  23. 23. Swagger -­‐ API Details
  24. 24. Swagger – Test the API
  25. 25. Swagger -­‐ API Details -­‐ JSON
  26. 26. Swagger – API Details -­‐ AnnotaMons
  27. 27. The Technology
  28. 28. Reverb -­‐ Wordnik Atmosphere – Scalatra – JSON4S
  29. 29. The Technology – Scala based • swagger-­‐core • swagger-­‐codegen • swagger-­‐ui • swagger-­‐js • swagger-­‐socket
  30. 30. Server side integraMons • Django • Node.js • JAX-­‐RS • RESTEasy • Grails • Play 2 • Scalatra • go-­‐rescul • SpringMVC • ServiceStack .net/MONO • Swagger-­‐PHP • Symphony 2 • Grape-­‐swagger for Ruby • Octohipster for Clojure • More…
  31. 31. Client code generaMon • Java • Scala • Groovy • Clojure • Python • Ruby • ObjecMveC • C# • PHP • Javascript • Custom • Uses {{mustache}} templates
  32. 32. Swagger is not
  33. 33. • Does not support mulMple API versions • Does not tell how to write the API – Delete an object by HTTP DELETE or via HTTP GET with query param • Is not trying to solve all problems for all APIs
  34. 34. Swagger 2.0
  35. 35. Emerging Standard • Thousands of developers contributed to the ecosystem • Tens of thousands of producMon deployments • From startups to US Government http://www.marketwatch.com/story/reverb-announces-swagger-20-a-next-generation-interface- to-connect-apis-and-cloud-services-2014-09-08?mod=mw_share_twitter
  36. 36. Swagger 2.0 • YAML support (along with JSON) • OAuth 2.0 enabled • Migrated to Java • Won’t be compaMble with 1.x
  37. 37. Swagger.io
  38. 38. Swagger Tools
  39. 39. Swagger UI
  40. 40. Swagger Tools
  41. 41. Swagger Tools
  42. 42. AlternaMves
  43. 43. • SOAP/WSDL – h?p://www.w3.org/TR/wsdl • WADL – h?p://en.wikipedia.org/wiki/ Web_ApplicaJon_DescripJon_Language • Mashery IO-­‐Docs – h?p://www.mashery.com/product/io-­‐docs – h?ps://github.com/mashery/iodocs • hFp://apiary.io/ • MuleSoP (RAML) – h?p://api-­‐portal.anypoint.mulesoL.com/raml-­‐tools?ref=apihub • Homegrown
  44. 44. References • Swagger home: – h?ps://developers.helloreverb.com/swagger/ • Swagger specificaMon – h?ps://github.com/wordnik/swagger-­‐core/wiki • Swagger Demo – h?p://petstore.swagger.wordnik.com/ • Swagger.io • Swagger editor – h?p://editor.swagger.io/ • Wordnik APIs – h?p://developer.wordnik.com/docs.html#!/account
  45. 45. Make your API accessible Use Swagger!

×