-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I propose the possibility of serializing composite types (like Object) into scalar values. This functional will be useful in those cases when some object can be represented in a scalar value, but it provides (can) a functional (a set of fields).
We can use the name __toScalar
field as the serializable value name. Double underline at the beginning is compatible with the standard adopted for system names.
For example:
Definition
type DateTimeObject {
year: Int!
month: Int!
# ...
ago: String!
format(format: String!): String!
__toScalar: DateTime!
}
Usage
As Object
{
date {
year
month
}
}
{
"date": {
"year": 2018,
"month": 04
}
}
As Scalar
{
date # __toScalar field usage
}
{
"date": "2018-04-28T04:53:23+03:00"
}
Metadata
Metadata
Assignees
Labels
No labels