graphql / graphql-spec

GraphQL is a query language and execution engine tied to any backend service.
https://spec.graphql.org
14.31k stars 1.12k forks source link

Document better what "internal types" are #594

Open andimarek opened 5 years ago

andimarek commented 5 years ago

There is this notion of "internal types" in the graphql spec: They are mentioned the first time in "Result Coercion" section of Scalars.

It is never explicitly stated how these internal types relate to the "external/visible" types of GraphQL and how they relate to the serialization.

For example: We have the Float scalar type of GraphQL and also an internal type of Float which is different, which is then maybe serialized to String.

michaelstaib commented 5 years ago

As I understood it the internal types are the type representation in the specific implementation. For instance the Float scalar in .Net could be represented internally as the .Net float or double types.

michaelstaib commented 5 years ago

A GraphQL service may decide to allow coercing different internal types to the expected return type. For example when coercing a field of type Int a boolean true value may produce 1 or a string value "123" may be parsed as base‐10 123. However if internal type coercion cannot be reasonably performed without losing information, then it must raise a field error.

this is the section you mean or?