schema_test.yml

  1types:
  2  - name: cannot be redeclared
  3    input: |
  4      type A {
  5        name: String
  6      }
  7      type A {
  8        name: String
  9      }
 10    error:
 11      message: "Cannot redeclare type A."
 12      locations: [{line: 4, column: 6}]
 13
 14interfaces:
 15  - name: must exist
 16    input: |
 17      type Thing implements Object {
 18        id: ID!
 19      }
 20
 21      type Query {
 22        Things: [Thing!]!
 23      }
 24    error:
 25      message: 'Undefined type "Object".'
 26      locations: [{line: 1, column: 6}]
 27
 28  - name: must be an interface
 29    input: |
 30      type Thing implements Object {
 31        id: ID!
 32      }
 33
 34      type Query {
 35        Things: [Thing!]!
 36      }
 37
 38      type Object {
 39        name: String
 40      }
 41    error:
 42      message: '"Object" is a non interface type OBJECT.'
 43      locations: [{line: 1, column: 6}]
 44
 45type extensions:
 46  - name: cannot extend non existant types
 47    input: |
 48      extend type A {
 49        name: String
 50      }
 51    error:
 52      message: "Cannot extend type A because it does not exist."
 53      locations: [{line: 1, column: 13}]
 54
 55  - name: cannot extend incorret type existant types
 56    input: |
 57      scalar A
 58      extend type A {
 59        name: String
 60      }
 61    error:
 62      message: "Cannot extend type A because the base type is a SCALAR, not OBJECT."
 63      locations: [{line: 2, column: 13}]
 64
 65directives:
 66  - name: cannot redeclare directives
 67    input: |
 68      directive @A on FIELD_DEFINITION
 69      directive @A on FIELD_DEFINITION
 70    error:
 71      message: "Cannot redeclare directive A."
 72      locations: [{line: 2, column: 12}]
 73
 74  - name: must be declared
 75    input: |
 76      type User {
 77        name: String @foo
 78      }
 79    error:
 80      message: "Undefined directive foo."
 81      locations: [{line: 2, column: 17}]
 82
 83  - name: cannot be self-referential
 84    input: |
 85      directive @A(foo: Int! @A) on FIELD_DEFINITION
 86    error:
 87      message: "Directive A cannot refer to itself."
 88      locations: [{line: 1, column: 25}]
 89
 90entry points:
 91  - name: multiple schema entry points
 92    input: |
 93      schema {
 94        query: Query
 95      }
 96      schema {
 97        query: Query
 98      }
 99      scalar Query
100    error:
101      message: "Cannot have multiple schema entry points, consider schema extensions instead."
102      locations: [{line: 4, column: 8}]
103
104  - name: Undefined schema entrypoint
105    input: |
106      schema {
107        query: Query
108      }
109    error:
110      message: "Schema root query refers to a type Query that does not exist."
111      locations: [{line: 2, column: 3}]
112
113entry point extensions:
114  - name: Undefined schema entrypoint
115    input: |
116      schema {
117        query: Query
118      }
119      scalar Query
120      extend schema {
121        mutation: Mutation
122      }
123    error:
124      message: "Schema root mutation refers to a type Mutation that does not exist."
125      locations: [{line: 6, column: 3}]
126
127type references:
128  - name: Field types
129    input: |
130      type User {
131        posts: Post
132      }
133    error:
134      message: "Undefined type Post."
135      locations: [{line: 2, column: 10}]
136
137  - name: Arg types
138    input: |
139      type User {
140        posts(foo: FooBar): String
141      }
142    error:
143      message: "Undefined type FooBar."
144      locations: [{line: 2, column: 14}]
145
146  - name: Directive arg types
147    input: |
148      directive @Foo(foo: FooBar) on FIELD_DEFINITION
149
150    error:
151      message: "Undefined type FooBar."
152      locations: [{line: 1, column: 21}]