haskell-graphql / graphql-api

Write type-safe GraphQL services in Haskell
BSD 3-Clause "New" or "Revised" License
406 stars 35 forks source link

Explicit type for nullable objects #100

Open jml opened 7 years ago

jml commented 7 years ago

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.

teh commented 7 years ago

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.