graphql / graphql-spec

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

Composite types is not clearly defined #1076

Closed andimarek closed 5 months ago

andimarek commented 9 months ago

The spec uses the word "composite" 5 times, but it is never clearly defined.

While it is quite clear that composite for output types means Interface, Object or Union the usage for input types is in my experience much less common. The only input composite type is Input Object and the spec uses it in this way too.

We should clearly define the meaning of composite type.

martinbonnin commented 9 months ago

+1 👍

Another option could be to just remove the "composite" term and be explicit instead? (i.e. use "object, interface or union")

Looks like the main place where the term is used in normative context is in field merging:

  1. If typeA or typeB is Scalar or Enum: ... a. If typeA and typeB are the same type return true, otherwise return false.
  2. Assert: typeA and typeB are both composite types.

That last sentence could be replaced by

  1. Assert: typeA is Object or Union or Interface and typeB is Object or Union or Interface.

It's more of a mouthful but the spec isn't really meant to be read out loud? :)