At a glance
- Identifier: #521
- Stage: RFC0: Strawman
- Champion: @IvanGoncharov
- PR: Scalar serialize as built-in scalar type
- Spec PR created on 2018-10-14 by IvanGoncharov
- Commit pushed: RFC: Scalar serialize as built-in scalar type on 2017-06-19 by @leebyron
As @leebyron suggested during last WG I'm adopting #326 and rebasing it on top of current master.
Currently, Custom Scalars only describe their name and no other behavior about them can be programmatically determined. However in practice most custom scalar types are specializations of one of the existing built-in scalar types (String, Int, Float, etc.).
This proposes adding one additional piece of metadata to custom scalars, a "serializes as" type which must be a built-in scalar type. This serialize as type describes what kinds of values are allowed to be provided as input to that type and what kind of value is expected to serialize from that type. This metadata is useful for code-generation systems which expect to generate code in well typed environments. It can also improve the validation accuracy and IDE ergonomics by providing a similar level of information about custom scalars as exist for the built-in scalars.
To provide this metadata to those kinds of tools, this also extends the introspection system to return the serialize as type in the