From d5c8fbdaded63d4a537031657d31292ed5066126 Mon Sep 17 00:00:00 2001 From: Corey Kovalik Date: Mon, 21 Jun 2021 17:38:33 -0700 Subject: [PATCH] fix(packages): adds `GraphQLNonNull` to the `modelType` for ResultList.items --- .../src/definitions/schemaDefinitions.ts | 2 +- .../GraphQLSchemaCreator.test.ts.snap | 46 +++++++++---------- .../__snapshots__/DataSyncPlugin.test.ts.snap | 8 ++-- .../__snapshots__/printSchema.test.ts.snap | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/graphback-codegen-schema/src/definitions/schemaDefinitions.ts b/packages/graphback-codegen-schema/src/definitions/schemaDefinitions.ts index 53e1fed123..c63f8c6c61 100644 --- a/packages/graphback-codegen-schema/src/definitions/schemaDefinitions.ts +++ b/packages/graphback-codegen-schema/src/definitions/schemaDefinitions.ts @@ -351,7 +351,7 @@ export const createModelListResultType = (modelType: GraphQLObjectType) => { name: `${modelType.name}ResultList`, fields: { items: { - type: GraphQLNonNull(GraphQLList(modelType)) + type: GraphQLNonNull(GraphQLList(GraphQLNonNull(modelType))) }, offset: { type: GraphQLInt }, limit: { type: GraphQLInt }, diff --git a/packages/graphback-codegen-schema/tests/__snapshots__/GraphQLSchemaCreator.test.ts.snap b/packages/graphback-codegen-schema/tests/__snapshots__/GraphQLSchemaCreator.test.ts.snap index 449dd8210e..01d829319a 100644 --- a/packages/graphback-codegen-schema/tests/__snapshots__/GraphQLSchemaCreator.test.ts.snap +++ b/packages/graphback-codegen-schema/tests/__snapshots__/GraphQLSchemaCreator.test.ts.snap @@ -13,7 +13,7 @@ type Note { } type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -243,7 +243,7 @@ input StringInput { } type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -274,7 +274,7 @@ enum SortDirectionEnum { } type TestResultList { - items: [Test]! + items: [Test!]! offset: Int limit: Int count: Int @@ -325,7 +325,7 @@ input CommentFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int @@ -528,7 +528,7 @@ input ModelWithArrayScalarFilter { } type ModelWithArrayScalarResultList { - items: [ModelWithArrayScalar]! + items: [ModelWithArrayScalar!]! offset: Int limit: Int count: Int @@ -560,7 +560,7 @@ input ModelWithTransientFieldFilter { } type ModelWithTransientFieldResultList { - items: [ModelWithTransientField]! + items: [ModelWithTransientField!]! offset: Int limit: Int count: Int @@ -657,7 +657,7 @@ input NoteFilter { } type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -749,7 +749,7 @@ input TestFilter { } type TestResultList { - items: [Test]! + items: [Test!]! offset: Int limit: Int count: Int @@ -799,7 +799,7 @@ input VersionedFilter { } type VersionedResultList { - items: [Versioned]! + items: [Versioned!]! offset: Int limit: Int count: Int @@ -911,7 +911,7 @@ type Test { scalar GraphbackJSON type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -943,7 +943,7 @@ enum SortDirectionEnum { } type TestResultList { - items: [Test]! + items: [Test!]! offset: Int limit: Int count: Int @@ -958,14 +958,14 @@ input TestFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int } type VersionedResultList { - items: [Versioned]! + items: [Versioned!]! offset: Int limit: Int count: Int @@ -1032,7 +1032,7 @@ type ModelWithTransientField { } type ModelWithTransientFieldResultList { - items: [ModelWithTransientField]! + items: [ModelWithTransientField!]! offset: Int limit: Int count: Int @@ -1053,7 +1053,7 @@ type ModelWithArrayScalar { } type ModelWithArrayScalarResultList { - items: [ModelWithArrayScalar]! + items: [ModelWithArrayScalar!]! offset: Int limit: Int count: Int @@ -1430,7 +1430,7 @@ type Test { scalar GraphbackJSON type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -1462,7 +1462,7 @@ enum SortDirectionEnum { } type TestResultList { - items: [Test]! + items: [Test!]! offset: Int limit: Int count: Int @@ -1477,14 +1477,14 @@ input TestFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int } type VersionedResultList { - items: [Versioned]! + items: [Versioned!]! offset: Int limit: Int count: Int @@ -1551,7 +1551,7 @@ type ModelWithTransientField { } type ModelWithTransientFieldResultList { - items: [ModelWithTransientField]! + items: [ModelWithTransientField!]! offset: Int limit: Int count: Int @@ -1572,7 +1572,7 @@ type ModelWithArrayScalar { } type ModelWithArrayScalarResultList { - items: [ModelWithArrayScalar]! + items: [ModelWithArrayScalar!]! offset: Int limit: Int count: Int @@ -1874,7 +1874,7 @@ input CommentFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int @@ -1964,7 +1964,7 @@ input NoteFilter { } type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int diff --git a/packages/graphback-datasync/tests/__snapshots__/DataSyncPlugin.test.ts.snap b/packages/graphback-datasync/tests/__snapshots__/DataSyncPlugin.test.ts.snap index 2f10c7fd83..13e96b3b86 100644 --- a/packages/graphback-datasync/tests/__snapshots__/DataSyncPlugin.test.ts.snap +++ b/packages/graphback-datasync/tests/__snapshots__/DataSyncPlugin.test.ts.snap @@ -45,7 +45,7 @@ input CommentFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int @@ -158,7 +158,7 @@ input NoteFilter { } type NoteResultList { - items: [Note]! + items: [Note!]! offset: Int limit: Int count: Int @@ -267,7 +267,7 @@ input CommentFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int @@ -399,7 +399,7 @@ input CommentFilter { } type CommentResultList { - items: [Comment]! + items: [Comment!]! offset: Int limit: Int count: Int diff --git a/packages/graphql-serve/tests/__snapshots__/printSchema.test.ts.snap b/packages/graphql-serve/tests/__snapshots__/printSchema.test.ts.snap index 26bb33dd19..ccee0522ef 100644 --- a/packages/graphql-serve/tests/__snapshots__/printSchema.test.ts.snap +++ b/packages/graphql-serve/tests/__snapshots__/printSchema.test.ts.snap @@ -86,7 +86,7 @@ input UserFilter { } type UserResultList { - items: [User]! + items: [User!]! offset: Int limit: Int count: Int