graphql-api icon indicating copy to clipboard operation
graphql-api copied to clipboard

Explicit type for nullable objects

Open jml opened this issue 9 years ago • 1 comments

It's possibly a bit dodgy relying on Maybe Foo in a schema definition to mean "Foo is nullable". I've forgotten why it's dodgy, but @teh can fill in.

jml avatar Jan 29 '17 17:01 jml

Experience from Aeson shows that we want to be very clear about the difference between a missing field and null. Maybe can communicate both, but in JSON missing and null are not the same (e.g. in JavaScript they get decoded to undefined and null on key lookup).

So IMO we should mark fields that can be null and fields that are optional differently and clearly.

teh avatar Jan 29 '17 17:01 teh