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
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. Swagger Philosophy!
• Solved by machine-readable, discoverable
API contract!
• Should speed up, not slow down
development process!
• External services/proxies not required!
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. 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. 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. 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. Swagger + Scalatra!
• Scalatra is a Lightweight, High-
performance Micro web framework!
• Extremely clean DSL!
• First-class swagger support!
• http://www.scalatra.org!