Instead of simple case class
es we make use of a system of Extensible Virtual Models to describe our models. This has the practical advantage of making these models run-time extensible while maintaining type-safety. This document serves as a brief introduction to this system and explains how it relates to normal case class
es.
Consider this simplified version of a Post and a function which operates on it:
case class Post(id : Id[Post], authorId : Id[Author], blogId : Id[Blog], title : String, body : Html)
def escapeBody(post : Post) : Post = ...
The model contains the Post's id, title, and body as well as foreign keys to its author and blog. This serves us well for many cases but sometimes we want to access properties of the author or blog of this post. Because retrieving these models requires API calls to the relevant service, we'd like to pass these models around with the post so we only retrieve them once.