Wouldn't it be nice if our Coursera's courier records automatically included Coursera JSON format implicits? Now, they can! Scala generators now take a GeneratorMixin class that can append additional lines at the end of each generated class and companion object. Mixin methods are called with org.coursera.courier.generator.specs.Definition, so mixin behavior can be schema-aware.
This PR includes core changes and tests. I struggled somewhat trying to declare a custom generator (with mixins) for my tests. Ultimately it worked to add a new library solely for the test generator, but I'd be happy to learn of a better way to do this.
Wouldn't it be nice if our Coursera's courier records automatically included Coursera JSON format implicits? Now, they can! Scala generators now take a
GeneratorMixin
class that can append additional lines at the end of each generated class and companion object. Mixin methods are called withorg.coursera.courier.generator.specs.Definition
, so mixin behavior can be schema-aware.This PR includes core changes and tests. I struggled somewhat trying to declare a custom generator (with mixins) for my tests. Ultimately it worked to add a new library solely for the test generator, but I'd be happy to learn of a better way to do this.