Skip to content

Commit

Permalink
Fix merged typeDefs not working correctly at runtime (#308)
Browse files Browse the repository at this point in the history
* Use mergeTypeDefs

* Add changeset

* Run yarn

* Add @graphql-tools/merge to root package.json

* Update e2e test outcome
  • Loading branch information
eddeee888 authored Jul 2, 2024
1 parent 906d454 commit bb9b5fe
Show file tree
Hide file tree
Showing 32 changed files with 6,244 additions and 21,591 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-points-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eddeee888/gcg-typescript-resolver-files': patch
---

Use @graphql-tools/merge to merge typeDefs
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@graphql-codegen/schema-ast": "4.1.0",
"@graphql-codegen/typescript": "4.0.8",
"@graphql-codegen/typescript-resolvers": "4.2.1",
"@graphql-tools/merge": "9.0.4",
"@nx/devkit": "19.0.2",
"@nx/eslint": "19.0.2",
"@nx/eslint-plugin": "19.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,138 +4,95 @@ export const typeDefs = {
definitions: [
{
kind: 'ObjectTypeDefinition',
name: { kind: 'Name', value: 'Query', loc: { start: 5, end: 10 } },
name: { kind: 'Name', value: 'Query' },
interfaces: [],
directives: [],
fields: [
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'test', loc: { start: 15, end: 19 } },
name: { kind: 'Name', value: 'test' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Test',
loc: { start: 21, end: 25 },
},
loc: { start: 21, end: 25 },
},
loc: { start: 21, end: 26 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Test' } },
},
directives: [],
loc: { start: 15, end: 26 },
},
],
loc: { start: 0, end: 28 },
},
{
kind: 'ObjectTypeDefinition',
name: { kind: 'Name', value: 'Test', loc: { start: 35, end: 39 } },
name: { kind: 'Name', value: 'Test' },
interfaces: [],
directives: [],
fields: [
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'id', loc: { start: 44, end: 46 } },
name: { kind: 'Name', value: 'id' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: { kind: 'Name', value: 'ID', loc: { start: 48, end: 50 } },
loc: { start: 48, end: 50 },
},
loc: { start: 48, end: 51 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'ID' } },
},
directives: [],
loc: { start: 44, end: 51 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'string', loc: { start: 54, end: 60 } },
name: { kind: 'Name', value: 'string' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'String',
loc: { start: 62, end: 68 },
},
loc: { start: 62, end: 68 },
name: { kind: 'Name', value: 'String' },
},
loc: { start: 62, end: 69 },
},
directives: [],
loc: { start: 54, end: 69 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'boolean', loc: { start: 72, end: 79 } },
name: { kind: 'Name', value: 'boolean' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Boolean',
loc: { start: 81, end: 88 },
},
loc: { start: 81, end: 88 },
name: { kind: 'Name', value: 'Boolean' },
},
loc: { start: 81, end: 89 },
},
directives: [],
loc: { start: 72, end: 89 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'int', loc: { start: 92, end: 95 } },
name: { kind: 'Name', value: 'int' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Int',
loc: { start: 97, end: 100 },
},
loc: { start: 97, end: 100 },
},
loc: { start: 97, end: 101 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
},
directives: [],
loc: { start: 92, end: 101 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'float', loc: { start: 104, end: 109 } },
name: { kind: 'Name', value: 'float' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Float',
loc: { start: 111, end: 116 },
},
loc: { start: 111, end: 116 },
},
loc: { start: 111, end: 117 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Float' } },
},
directives: [],
loc: { start: 104, end: 117 },
},
],
loc: { start: 30, end: 119 },
},
{
kind: 'SchemaDefinition',
operationTypes: [
{
kind: 'OperationTypeDefinition',
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } },
operation: 'query',
},
],
},
],
loc: { start: 0, end: 120 },
} as unknown as DocumentNode;
Original file line number Diff line number Diff line change
Expand Up @@ -4,138 +4,95 @@ export const typeDefs = {
definitions: [
{
kind: 'ObjectTypeDefinition',
name: { kind: 'Name', value: 'Query', loc: { start: 5, end: 10 } },
name: { kind: 'Name', value: 'Query' },
interfaces: [],
directives: [],
fields: [
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'test', loc: { start: 15, end: 19 } },
name: { kind: 'Name', value: 'test' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Test',
loc: { start: 21, end: 25 },
},
loc: { start: 21, end: 25 },
},
loc: { start: 21, end: 26 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Test' } },
},
directives: [],
loc: { start: 15, end: 26 },
},
],
loc: { start: 0, end: 28 },
},
{
kind: 'ObjectTypeDefinition',
name: { kind: 'Name', value: 'Test', loc: { start: 35, end: 39 } },
name: { kind: 'Name', value: 'Test' },
interfaces: [],
directives: [],
fields: [
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'id', loc: { start: 44, end: 46 } },
name: { kind: 'Name', value: 'id' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: { kind: 'Name', value: 'ID', loc: { start: 48, end: 50 } },
loc: { start: 48, end: 50 },
},
loc: { start: 48, end: 51 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'ID' } },
},
directives: [],
loc: { start: 44, end: 51 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'string', loc: { start: 54, end: 60 } },
name: { kind: 'Name', value: 'string' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'String',
loc: { start: 62, end: 68 },
},
loc: { start: 62, end: 68 },
name: { kind: 'Name', value: 'String' },
},
loc: { start: 62, end: 69 },
},
directives: [],
loc: { start: 54, end: 69 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'boolean', loc: { start: 72, end: 79 } },
name: { kind: 'Name', value: 'boolean' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Boolean',
loc: { start: 81, end: 88 },
},
loc: { start: 81, end: 88 },
name: { kind: 'Name', value: 'Boolean' },
},
loc: { start: 81, end: 89 },
},
directives: [],
loc: { start: 72, end: 89 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'int', loc: { start: 92, end: 95 } },
name: { kind: 'Name', value: 'int' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Int',
loc: { start: 97, end: 100 },
},
loc: { start: 97, end: 100 },
},
loc: { start: 97, end: 101 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
},
directives: [],
loc: { start: 92, end: 101 },
},
{
kind: 'FieldDefinition',
name: { kind: 'Name', value: 'float', loc: { start: 104, end: 109 } },
name: { kind: 'Name', value: 'float' },
arguments: [],
type: {
kind: 'NonNullType',
type: {
kind: 'NamedType',
name: {
kind: 'Name',
value: 'Float',
loc: { start: 111, end: 116 },
},
loc: { start: 111, end: 116 },
},
loc: { start: 111, end: 117 },
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Float' } },
},
directives: [],
loc: { start: 104, end: 117 },
},
],
loc: { start: 30, end: 119 },
},
{
kind: 'SchemaDefinition',
operationTypes: [
{
kind: 'OperationTypeDefinition',
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } },
operation: 'query',
},
],
},
],
loc: { start: 0, end: 120 },
} as unknown as DocumentNode;
Loading

0 comments on commit bb9b5fe

Please sign in to comment.