Skip to content

Commit

Permalink
chore(compiler): implicit schema definition snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlna authored and SimonSapin committed Oct 10, 2023
1 parent f1dffd1 commit 5065bc7
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Query {
name: String
}

extend schema {
query: Query
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Error: duplicate definitions for the `query` root operation type
╭─[0108_implicit_schema_extension.graphql:6:5]
6 │ query: Query
│ ──────┬─────
│ ╰─────── `query` redefined here
───╯

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type Query {
name: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0..31 @34 ObjectTypeDefinition {
description: None,
name: "Query",
implements_interfaces: [],
directives: [],
fields: [
17..29 @34 FieldDefinition {
description: None,
name: "name",
arguments: [],
ty: Named(
"String",
),
directives: [],
},
],
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type Query {
name: String
}

type Mutation {
add(name: String!): Result!
}

type Result {
id: String
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
0..31 @35 ObjectTypeDefinition {
description: None,
name: "Query",
implements_interfaces: [],
directives: [],
fields: [
17..29 @35 FieldDefinition {
description: None,
name: "name",
arguments: [],
ty: Named(
"String",
),
directives: [],
},
],
}
33..81 @35 ObjectTypeDefinition {
description: None,
name: "Mutation",
implements_interfaces: [],
directives: [],
fields: [
52..79 @35 FieldDefinition {
description: None,
name: "add",
arguments: [
56..69 @35 InputValueDefinition {
description: None,
name: "name",
ty: 62..69 @35 NonNullNamed(
"String",
),
default_value: None,
directives: [],
},
],
ty: NonNullNamed(
"Result",
),
directives: [],
},
],
}
83..111 @35 ObjectTypeDefinition {
description: None,
name: "Result",
implements_interfaces: [],
directives: [],
fields: [
99..109 @35 FieldDefinition {
description: None,
name: "id",
arguments: [],
ty: Named(
"String",
),
directives: [],
},
],
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type Query {
name: String
}

extend schema @dir
directive @dir on SCHEMA
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
0..31 @36 ObjectTypeDefinition {
description: None,
name: "Query",
implements_interfaces: [],
directives: [],
fields: [
17..29 @36 FieldDefinition {
description: None,
name: "name",
arguments: [],
ty: Named(
"String",
),
directives: [],
},
],
}
33..51 @36 SchemaExtension {
directives: [
47..51 @36 Directive {
name: "dir",
arguments: [],
},
],
root_operations: [],
}
52..76 @36 DirectiveDefinition {
description: None,
name: "dir",
arguments: [],
repeatable: false,
locations: [
"SCHEMA",
],
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Query {
name: String
}

extend schema {
query: Query
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type Query {
name: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type Query {
name: String
}

type Mutation {
add(name: String!): Result!
}

type Result {
id: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Query {
name: String
}

extend schema @dir

directive @dir on SCHEMA

0 comments on commit 5065bc7

Please sign in to comment.