eed3si9n / sjson-new

a typeclass based JSON codec that's backend independent
Apache License 2.0
36 stars 19 forks source link

a field with empty Vector value gets omitted #83

Closed eed3si9n closed 7 years ago

eed3si9n commented 7 years ago

steps

Make an object with a Vector field, serialize it to JSON.

problem

The field is omitted. For example, in the following example, "diagnostics": [] is missing.

JsonRpcNotificationMessage(2.0, textDocument/publishDiagnostics, {"uri":"file:/xxx/Hello.scala"})

The receiver of the message is not happy.

expectation

Empty fields are not omitted.

notes

This was an intentional design added in #6. I think Option[A] can continue to elide.

dwijnand commented 7 years ago

https://github.com/eed3si9n/sjson-new/pull/72

eed3si9n commented 7 years ago

Yea, I was wrong on this design decision. I still do think we need some way of evolving the JSON schema while remaining bincompat on Scala side. I'll go back to the drawing board.