finch.model.mustache Maven / Gradle / Ivy
package {{modelPackage}}
import io.circe._
import io.finch.circe._
import io.circe.generic.semiauto._
import io.circe.java8.time._
import {{packageName}}._
{{#imports}}import {{import}}
{{/imports}}
{{#models}}
{{#model}}
/**
* {{{description}}}
{{#vars}}
* @param {{name}} {{{description}}}
{{/vars}}
*/
case class {{classname}}({{#vars}}{{name}}: {{^required}}Option[{{{datatype}}}]{{/required}}{{#required}}{{{datatype}}}{{/required}}{{^-last}},{{/-last}}
{{/vars}})
object {{classname}} {
/**
* Creates the codec for converting {{classname}} from and to JSON.
*/
implicit val decoder: Decoder[{{classname}}] = deriveDecoder
implicit val encoder: ObjectEncoder[{{classname}}] = deriveEncoder
}
{{/model}}
{{/models}}