Closed
Description
The Coercion functions for Scalars are currently named:
- serialize: this is result or output coercion
- parseValue: this is runtime object input coercion
- parseLiteral: this is Ast literal input coercion
- (See Convert arbitrary scalar values into ASTs and back #1817): serializeAsLiteral this takes an input value and converts it to an Ast literal
I don't think the current names align very well with the spec: the spec talks about "Result Coercion" and "Input Coercion". Also parseValue
doesn't parse anything, but convert a runtime input value to an internal value.
In my mental model parseValue
and parseLiteral
produce a internalInputValue
and serializeAsLiteral
converts the internalInputValue
to a literal
.
First rough idea (I am sure we can do better, just to start the discussion)
coerceOutput
orcoerceResult
(the spec talks about result coercion, but output would mirror input)coerceInputValue
coerceInputLiteral
coerceInternalValueAsLiteral
In GraphQL Java we are also thinking about renaming (and adding a 4th one) and it would be great to have a discussion about a more clear naming.
Activity
sungam3r commentedon Mar 14, 2021
Just for information. GraphQL.NET in v4 has 7 methods for any scalar . See ScalarGraphType.
rename parseConstValue method to coerceInputLiteral
parseConstLiteral()
method #4218rename parseConstValue method to coerceInputLiteral
rename parseConstValue method to coerceInputLiteral
improve new leaf type `parseConstLiteral()` method (#4218)
yaacovCR commentedon Oct 17, 2024
Closed by #4218 and #4241
rename serialize and parseValue methods (#4241)