aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/github.com/vektah/gqlparser/validator/schema_test.yml
blob: 59e7145c4163971662468816abe3b35b3583b340 (plain) (tree)























































































































































                                                                                              
types:
  - name: cannot be redeclared
    input: |
      type A {
        name: String
      }
      type A {
        name: String
      }
    error:
      message: "Cannot redeclare type A."
      locations: [{line: 4, column: 6}]

interfaces:
  - name: must exist
    input: |
      type Thing implements Object {
        id: ID!
      }

      type Query {
        Things: [Thing!]!
      }
    error:
      message: 'Undefined type "Object".'
      locations: [{line: 1, column: 6}]

  - name: must be an interface
    input: |
      type Thing implements Object {
        id: ID!
      }

      type Query {
        Things: [Thing!]!
      }

      type Object {
        name: String
      }
    error:
      message: '"Object" is a non interface type OBJECT.'
      locations: [{line: 1, column: 6}]

type extensions:
  - name: cannot extend non existant types
    input: |
      extend type A {
        name: String
      }
    error:
      message: "Cannot extend type A because it does not exist."
      locations: [{line: 1, column: 13}]

  - name: cannot extend incorret type existant types
    input: |
      scalar A
      extend type A {
        name: String
      }
    error:
      message: "Cannot extend type A because the base type is a SCALAR, not OBJECT."
      locations: [{line: 2, column: 13}]

directives:
  - name: cannot redeclare directives
    input: |
      directive @A on FIELD_DEFINITION
      directive @A on FIELD_DEFINITION
    error:
      message: "Cannot redeclare directive A."
      locations: [{line: 2, column: 12}]

  - name: must be declared
    input: |
      type User {
        name: String @foo
      }
    error:
      message: "Undefined directive foo."
      locations: [{line: 2, column: 17}]

  - name: cannot be self-referential
    input: |
      directive @A(foo: Int! @A) on FIELD_DEFINITION
    error:
      message: "Directive A cannot refer to itself."
      locations: [{line: 1, column: 25}]

entry points:
  - name: multiple schema entry points
    input: |
      schema {
        query: Query
      }
      schema {
        query: Query
      }
      scalar Query
    error:
      message: "Cannot have multiple schema entry points, consider schema extensions instead."
      locations: [{line: 4, column: 8}]

  - name: Undefined schema entrypoint
    input: |
      schema {
        query: Query
      }
    error:
      message: "Schema root query refers to a type Query that does not exist."
      locations: [{line: 2, column: 3}]

entry point extensions:
  - name: Undefined schema entrypoint
    input: |
      schema {
        query: Query
      }
      scalar Query
      extend schema {
        mutation: Mutation
      }
    error:
      message: "Schema root mutation refers to a type Mutation that does not exist."
      locations: [{line: 6, column: 3}]

type references:
  - name: Field types
    input: |
      type User {
        posts: Post
      }
    error:
      message: "Undefined type Post."
      locations: [{line: 2, column: 10}]

  - name: Arg types
    input: |
      type User {
        posts(foo: FooBar): String
      }
    error:
      message: "Undefined type FooBar."
      locations: [{line: 2, column: 14}]

  - name: Directive arg types
    input: |
      directive @Foo(foo: FooBar) on FIELD_DEFINITION

    error:
      message: "Undefined type FooBar."
      locations: [{line: 1, column: 21}]