konsoletyper / teavm-flavour

Framework for writing client-side applications using TeaVM
Apache License 2.0
110 stars 19 forks source link

issue 19 JSON Deserialization Should Allow Missing - allow missing fi… #39

Open dbford opened 4 years ago

dbford commented 4 years ago

Per https://github.com/konsoletyper/teavm-flavour/issues/19, allow missing fields during JSON deserialization by considering 'undefined' and 'null' to be the same in the Node.isNull() method.

This is a desirable feature for a project I'm involved with. We have a large java type that is being passed in REST responses with values that are often null. The type is large enough that the byte savings from excluding null fields is the response is worth it. This feature would allow that.

konsoletyper commented 4 years ago

This is not the way so solve the problem. What if null is an expected value of a required field? Also, there's required attribute in @JsonProperty annotation, you should also support it.