Contract First, Session Types Later!
summary
Claim: REST APIs can carry resource state machines but session types don’t map cleanly yet. Implementation uses Play-Swagger and a custom extension that extended Swagger with resource state machines and a Scala library using typeclass CPS session types in Scala to encode in/out/stop as duals. The compiler rejects invalid state transitions and misaligned sends, giving compile-time enforcement of state transitions, but choice/branching cannot be encoded, so full session-type safety for hypermedia remains unsolved.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 2:54Single Source of Truth
- 4:29Stateless Communication
- 12:00Session Types
- 13:17State Analyzer
- 21:21Questions
related talks
49mBeautiful APIs with Scala, Scalatra, Swagger, and Akka
43mAPI first with Swagger and Scala
58mA Better REST with Type level Programming in Scala
40mScala Meta Live Coding Session
20mIndex your State for Safer Functional APIs
36mScale By The Bay 2018 Unconference: Devon Stewart
51mREST beyond the obvious – API design for ever evolving systems
38mScalaJS and Typescript: an unlikely romance
