Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Fastest to Mobile!
With Scalatra + Swagger!
!
@fehguy!
Swagger Philosophy!
Swagger Philosophy!
Service documentation sucks!
!
typically(
Swagger Philosophy!
•  Communicating is too much work!
– Users don’t want to write YOUR SDK!
– If you’re good at Ruby, you...
Swagger Philosophy!
•  Solved by machine-readable, discoverable
API contract!
•  Should speed up, not slow down
developmen...
What is Swagger?!
•  An interface to your service!
– Described in JSON!
•  It is a contract to your service!
•  Enables “b...
How does it work?!
•  Discoverable at runtime, not compile-time!
•  It’s just JSON!
•  No server integration required!
– Y...
But Why?!
•  Machine-readable contract!
–  Description of *everything* the server
can do!
–  Server-controlled documentati...
How do you add Swagger?!
•  Static Files!
– Manually crafted JSON!
•  Heuristics!
– Traffic inspection!
•  Code inspection!...
Swagger + Scalatra!
•  Scalatra is a Lightweight, High-
performance Micro web framework!
•  Extremely clean DSL!
•  First-...
Scalatra as a REST API!
Scalatra as a REST API!
Content&Type&
Nego,a,on&via&
json4s&
Scalatra as a REST API!
Content&Type&
Nego,a,on&via&
json4s&
Simple&Rou,ng&
Scalatra as a REST API!
Content&Type&
Nego,a,on&via&
json4s&
Simple&Rou,ng&
Param&
Extrac,on&
Scalatra as a REST API!
Swagger + Scalatra!
•  Without Swagger Support!
•  With Swagger Support!
Swagger + Scalatra!
•  Auto-
generation of
swagger JSON!!
Swagger + Scalatra!
•  No ugly Java annotations!!
Swagger + Scalatra!
•  Model descriptions!
Swagger + Scalatra!
•  Model descriptions!
Type&safety&
has&its&
benefits!&
Swagger UI for “free”!
Swagger UI for “free”!
Your&Boss&
can&try&your&
API!&
Going Moble!
•  If you are good at scala, you probably
suck at Objective C!
Swagger + Mustache!
•  Typesafe conversion between swagger to
Objective C!
Swagger + Mustache!
•  Typesafe conversion between swagger to
Objective C!
Templates&
you&can&
Tweak!&
Mustache Templates!
Mustache Templates!
Sharing Libraries with Love!
Other Mobile SDKs!
•  Android + Java!
Other Mobile SDKs!
•  Android + Java!
Other Mobile SDKs!
•  Javascript!
Scalatra + Swagger!
•  Simplest DSL for REST APIs in Scala!
•  Minimal dependencies!
•  Tested at scale!
•  Not “hello wor...
https://helloreverb.com/swagger/!
!
Questions?!
Upcoming SlideShare
Loading in …5
×

Fastest to Mobile with Scalatra + Swagger

1,967 views

Published on

Presentation by Tony Tam on using the Scalatra micro web framework with native support for Swagger. This gives the fastest possible server-to-mobile integration with Scala

Published in: Technology
  • Be the first to comment

Fastest to Mobile with Scalatra + Swagger

  1. 1. Fastest to Mobile! With Scalatra + Swagger! ! @fehguy!
  2. 2. Swagger Philosophy!
  3. 3. Swagger Philosophy! Service documentation sucks! ! typically(
  4. 4. Swagger Philosophy! •  Communicating is too much work! – Users don’t want to write YOUR SDK! – If you’re good at Ruby, you suck at GO! •  Consumers need a contract! – Service logic doesn’t belong in the SDK! •  Services are plumbing! – We shouldn’t all be plumbers! – Business logic is your business!
  5. 5. Swagger Philosophy! •  Solved by machine-readable, discoverable API contract! •  Should speed up, not slow down development process! •  External services/proxies not required!
  6. 6. What is Swagger?! •  An interface to your service! – Described in JSON! •  It is a contract to your service! •  Enables “bigotry-free” restful design with emphasis on getting things done! – Many ways to delete a Pet!
  7. 7. How does it work?! •  Discoverable at runtime, not compile-time! •  It’s just JSON! •  No server integration required! – You can describe an API that’s not even yours! – Deploy anywhere! Put it on github!! – Swagger is JUST a way to describe an API!
  8. 8. But Why?! •  Machine-readable contract! –  Description of *everything* the server can do! –  Server-controlled documentation! –  Server/language/platform/deployment agnostic! •  Documentation, code generation, client generation! –  Like Headers for C, Interfaces for Java!
  9. 9. How do you add Swagger?! •  Static Files! – Manually crafted JSON! •  Heuristics! – Traffic inspection! •  Code inspection! – Code comments, static annotations! •  Runtime generation! It’s just JSON!!
  10. 10. Swagger + Scalatra! •  Scalatra is a Lightweight, High- performance Micro web framework! •  Extremely clean DSL! •  First-class swagger support! •  http://www.scalatra.org!
  11. 11. Scalatra as a REST API!
  12. 12. Scalatra as a REST API! Content&Type& Nego,a,on&via& json4s&
  13. 13. Scalatra as a REST API! Content&Type& Nego,a,on&via& json4s& Simple&Rou,ng&
  14. 14. Scalatra as a REST API! Content&Type& Nego,a,on&via& json4s& Simple&Rou,ng& Param& Extrac,on&
  15. 15. Scalatra as a REST API!
  16. 16. Swagger + Scalatra! •  Without Swagger Support! •  With Swagger Support!
  17. 17. Swagger + Scalatra! •  Auto- generation of swagger JSON!!
  18. 18. Swagger + Scalatra! •  No ugly Java annotations!!
  19. 19. Swagger + Scalatra! •  Model descriptions!
  20. 20. Swagger + Scalatra! •  Model descriptions! Type&safety& has&its& benefits!&
  21. 21. Swagger UI for “free”!
  22. 22. Swagger UI for “free”! Your&Boss& can&try&your& API!&
  23. 23. Going Moble! •  If you are good at scala, you probably suck at Objective C!
  24. 24. Swagger + Mustache! •  Typesafe conversion between swagger to Objective C!
  25. 25. Swagger + Mustache! •  Typesafe conversion between swagger to Objective C! Templates& you&can& Tweak!&
  26. 26. Mustache Templates!
  27. 27. Mustache Templates!
  28. 28. Sharing Libraries with Love!
  29. 29. Other Mobile SDKs! •  Android + Java!
  30. 30. Other Mobile SDKs! •  Android + Java!
  31. 31. Other Mobile SDKs! •  Javascript!
  32. 32. Scalatra + Swagger! •  Simplest DSL for REST APIs in Scala! •  Minimal dependencies! •  Tested at scale! •  Not “hello world”! •  Apache 2.0 everything!
  33. 33. https://helloreverb.com/swagger/! ! Questions?!

×