jcazevedo / moultingyaml

Scala wrapper for SnakeYAML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List not recursive for YamlWriter

siddhartha-gadgil opened this issue · comments

When I define a custom YamlWriter, one for the list is not automatically generated. Here is a session (in an ammonite repl).

@ case object blah 
defined object blah

@ implicit object BlahWriter extends YamlWriter[blah.type]{
  def write(c: blah.type) = YamlObject(YamlString("blah") -> YamlString(1.toString))
  }  
defined object BlahWriter

@ blah.toYaml 
res4: YamlValue = YamlObject(Map(YamlString("blah") -> YamlString("1")))

@ List(blah, blah).toYaml 
cmd5.sc:1: Cannot find YamlWriter or YamlFormat type class for List[ammonite.$sess.cmd2.blah.type]
val res5 = List(blah, blah).toYaml
                            ^
Compilation Failed

I would be happy to submit a pull request fixing this if it is not fixed yet.

I see this is a trivial issue, the recursive definitions are only for a YamlFormat, not separately for a YamlReader or YamlWriter. Will add these.