From 059941486fcea9b93c5a156fe80df03d2021c0b4 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Mon, 25 Apr 2016 11:18:14 -0700 Subject: [PATCH] Clarify that composite types must define at least one field. As pointed out by https://github.com/graphql/graphql-js/pull/368 --- spec/Section 3 -- Type System.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/spec/Section 3 -- Type System.md b/spec/Section 3 -- Type System.md index 4e39c845a..fb2d475be 100644 --- a/spec/Section 3 -- Type System.md +++ b/spec/Section 3 -- Type System.md @@ -506,9 +506,10 @@ treated in documentation and tooling. Object types have the potential to be invalid if incorrectly defined. This set of rules must be adhered to by every Object type in a GraphQL schema. -1. The fields of an Object type must have unique names within that Object type; +1. An Object type must define one or more fields. +2. The fields of an Object type must have unique names within that Object type; no two fields may share the same name. -2. An object type must be a super-set of all interfaces it implements. +3. An object type must be a super-set of all interfaces it implements: 1. The object type must include a field of the same name for every field defined in an interface. 1. The object field must be of a type which is equal to or a sub-type of @@ -633,7 +634,8 @@ Interfaces are never valid inputs. Interface types have the potential to be invalid if incorrectly defined. -1. The fields of an Interface type must have unique names within that Interface +1. An Interface type must define one or more fields. +2. The fields of an Interface type must have unique names within that Interface type; no two fields may share the same name. @@ -776,6 +778,13 @@ corresponding entry, the value is the result of coercing null. The input coercion above should be performed according to the input coercion rules of the type declared by the input field. +#### Input Object type validation + +1. An Input Object type must define one or more fields. +2. The fields of an Input Object type must have unique names within that + Input Object type; no two fields may share the same name. +3. The return types of each defined field must be an Input type. + ### Lists @@ -863,6 +872,10 @@ query withNullableVariable($var: String) { } ``` +#### Non-Null type validation + +1. A Non-Null type must not wrap another Non-Null type. + ## Directives