From 86724a4152e85316d957daef0b187df1723af5a3 Mon Sep 17 00:00:00 2001 From: Ben McCallum Date: Wed, 14 Apr 2021 16:36:47 +0200 Subject: [PATCH 1/4] feat: Support for [ID]! following HC fix --- ...ttributeTests.Id_On_Arguments.verified.txt | 6 +++++- ..._On_Arguments_isEnabled=False.verified.txt | 12 +++++++++++ ...d_On_Arguments_isEnabled=True.verified.txt | 6 +++++- .../IdAttributeTests.cs | 16 +++++++------- .../PolymorphicIdInputValueFormatter.cs | 21 +++++++++---------- src/Directory.Build.props | 3 +-- 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Arguments.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Arguments.verified.txt index e1da1f5..2e0aac2 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Arguments.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Arguments.verified.txt @@ -4,17 +4,21 @@ "nullableIntId": "1", "nullableIntIdGivenNull": "null", "intIdList": "1", + "nullableIntIdList": "1, null", "longId": "9223372036854775807", "nullableLongId": "9223372036854775807", "nullableLongIdGivenNull": "null", "longIdList": "9223372036854775807", + "nullableLongIdList": "9223372036854775807, null", "stringId": "abc", "nullableStringId": "abc", "nullableStringIdGivenNull": "null", "stringIdList": "abc", + "nullableStringIdList": "abc, null", "guidId": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5", "nullableGuidId": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5", "nullableGuidIdGivenNull": "null", - "guidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5" + "guidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5", + "nullableGuidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, null, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5" } } \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt index 5c208d9..a45ec85 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt @@ -1,5 +1,8 @@ { "errors": [ + { + "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, , 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." + }, { "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." }, @@ -9,6 +12,9 @@ { "message": "The ID \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 has an invalid format." }, + { + "message": "The IDs \u0060abc, \u0060 have an invalid format." + }, { "message": "The IDs \u0060abc\u0060 have an invalid format." }, @@ -18,6 +24,9 @@ { "message": "The ID \u0060abc\u0060 has an invalid format." }, + { + "message": "The IDs \u00609223372036854775807, \u0060 have an invalid format." + }, { "message": "The IDs \u00609223372036854775807\u0060 have an invalid format." }, @@ -27,6 +36,9 @@ { "message": "The ID \u00609223372036854775807\u0060 has an invalid format." }, + { + "message": "The IDs \u00601, \u0060 have an invalid format." + }, { "message": "The IDs \u00601\u0060 have an invalid format." }, diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=True.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=True.verified.txt index e1da1f5..2e0aac2 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=True.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=True.verified.txt @@ -4,17 +4,21 @@ "nullableIntId": "1", "nullableIntIdGivenNull": "null", "intIdList": "1", + "nullableIntIdList": "1, null", "longId": "9223372036854775807", "nullableLongId": "9223372036854775807", "nullableLongIdGivenNull": "null", "longIdList": "9223372036854775807", + "nullableLongIdList": "9223372036854775807, null", "stringId": "abc", "nullableStringId": "abc", "nullableStringIdGivenNull": "null", "stringIdList": "abc", + "nullableStringIdList": "abc, null", "guidId": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5", "nullableGuidId": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5", "nullableGuidIdGivenNull": "null", - "guidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5" + "guidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5", + "nullableGuidIdList": "26a2dc8f-4dab-408c-88c6-523a0a89a2b5, null, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5" } } \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs index 9c5b7e6..6750fd1 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs @@ -16,7 +16,6 @@ namespace AutoGuru.HotChocolate.PolymorphicIds.Tests { [UsesVerify] [SuppressMessage("Style", "IDE1006:Naming Styles")] - [SuppressMessage("Performance", "CA1822:Mark members as static")] public class IdAttributeTests { private static readonly RequestExecutorOptions _executorOptions = new () @@ -25,8 +24,6 @@ public class IdAttributeTests IncludeExceptionDetails = true }; - // TODO: When PR 3440 in HC is merged, uncomment array with nulls field usages below in queries - private const string _argumentsQuery = @" query foo ( $intId: ID! @@ -39,25 +36,25 @@ query foo ( nullableIntId(id: $intId) nullableIntIdGivenNull: nullableIntId(id: $null) intIdList(id: [$intId]) - # TODO: nullableIntIdList(id: [$intId, $null]) + nullableIntIdList(id: [$intId, $null]) longId(id: $longId) nullableLongId(id: $longId) nullableLongIdGivenNull: nullableLongId(id: $null) longIdList(id: [$longId]) - # TODO: nullableLongIdList(id: [$longId, $null]) + nullableLongIdList(id: [$longId, $null]) stringId(id: $stringId) nullableStringId(id: $stringId) nullableStringIdGivenNull: nullableStringId(id: $null) stringIdList(id: [$stringId]) - # TODO: nullableStringIdList(id: [$stringId, $null]) + nullableStringIdList(id: [$stringId, $null]) guidId(id: $guidId) nullableGuidId(id: $guidId) nullableGuidIdGivenNull: nullableGuidId(id: $null) guidIdList(id: [$guidId $guidId]) - # TODO: nullableGuidIdList(id: [$guidId $null $guidId]) + nullableGuidIdList(id: [$guidId $null $guidId]) }"; [Theory] @@ -166,7 +163,7 @@ await SchemaBuilder.New() someId: $someId someIds: [$someIntId] someNullableId: $someId - someNullableIds: [$someIntId] }) # TODO: null] }) + someNullableIds: [$someIntId, null] }) { someId someNullableId @@ -331,7 +328,7 @@ await SchemaBuilder.New() someId: $someId someIds: [$someIntId] someNullableId: null - someNullableIds: [$someIntId] }) # TODO: null + someNullableIds: [$someIntId, null] }) { someId someNullableId @@ -429,6 +426,7 @@ await Verifier.Verify(new #endregion + [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Can't be static for HC")] public class Query { public string IntId([ID] int id) => id.ToString(); diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds/PolymorphicIdInputValueFormatter.cs b/src/AutoGuru.HotChocolate.PolymorphicIds/PolymorphicIdInputValueFormatter.cs index cf6e7d6..67f1e87 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds/PolymorphicIdInputValueFormatter.cs +++ b/src/AutoGuru.HotChocolate.PolymorphicIds/PolymorphicIdInputValueFormatter.cs @@ -36,22 +36,21 @@ public PolymorphicIdInputValueFormatter( return DeserializeId(s); } - if (runtimeValue is IEnumerable stringEnumerable) // TODO: When PR 3440 in HC is merged, this should become IEnumerable + if (runtimeValue is IEnumerable stringEnumerable) { try { - var list = new List();// TODO: When PR 3440 in HC is merged, this should become List + var list = new List(); foreach (var sv in stringEnumerable) { - // TODO: When PR 3440 in HC is merged, this should be uncommented - //if (sv is null) - //{ - // list.Add(null); - //} - //else - //{ - list.Add(DeserializeId(sv)); - //} + if (sv is null) + { + list.Add(null); + } + else + { + list.Add(DeserializeId(sv)); + } } return list; } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ccb881d..551b03a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -17,11 +17,10 @@ enable latest - 11.1.0 + 11.2.0-preview.17 net5.0; netcoreapp3.1; netstandard2.0 net5.0; netcoreapp3.1 - From 3d7fb6beb6ce014b6e1631a453feab91c57c1aff Mon Sep 17 00:00:00 2001 From: Ben McCallum Date: Wed, 14 Apr 2021 16:53:55 +0200 Subject: [PATCH 2/4] Add schema test --- .../IdAttributeTests.Schema.verified.txt | 52 +++++++++++++++++++ .../IdAttributeTests.cs | 25 +++++++-- 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt new file mode 100644 index 0000000..8621d45 --- /dev/null +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt @@ -0,0 +1,52 @@ +schema { + query: Query +} + +interface IFooPayload { + someId: ID! + someNullableId: ID + someIds: [ID!]! + someNullableIds: [ID] + raw: String! +} + +type FooPayload implements IFooPayload { + someId: ID! + someIds: [ID!]! + someNullableId: ID + someNullableIds: [ID] + raw: String! +} + +type Query { + intId(id: ID!): String! + intIdList(id: [ID!]!): String! + nullableIntId(id: ID): String! + nullableIntIdList(id: [ID]!): String! + longId(id: ID!): String! + longIdList(id: [ID!]!): String! + nullableLongId(id: ID): String! + nullableLongIdList(id: [ID]!): String! + stringId(id: ID!): String! + stringIdList(id: [ID!]!): String! + nullableStringId(id: ID): String! + nullableStringIdList(id: [ID]!): String! + guidId(id: ID!): String! + guidIdList(id: [ID!]!): String! + nullableGuidId(id: ID): String! + nullableGuidIdList(id: [ID]!): String! + foo(input: FooInput!): IFooPayload! +} + +input FooInput { + someId: ID! + someNullableId: ID + someIds: [ID!]! + someNullableIds: [ID] +} + +"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." +directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT + +"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." +directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean!) on FIELD \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs index 6750fd1..89bd714 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs @@ -163,7 +163,8 @@ await SchemaBuilder.New() someId: $someId someIds: [$someIntId] someNullableId: $someId - someNullableIds: [$someIntId, null] }) + someNullableIds: [$someIntId, null] + }) { someId someNullableId @@ -280,7 +281,8 @@ await SchemaBuilder.New() someId: $someId someIds: [$someIntId] someNullableId: $someId - someNullableIds: [$someIntId] }) + someNullableIds: [$someIntId] + }) { someId someNullableId @@ -328,7 +330,8 @@ await SchemaBuilder.New() someId: $someId someIds: [$someIntId] someNullableId: null - someNullableIds: [$someIntId, null] }) + someNullableIds: [$someIntId, null] + }) { someId someNullableId @@ -426,6 +429,22 @@ await Verifier.Verify(new #endregion + [Fact] + public async Task Schema() + { + // arrange / act + var schema = + SchemaBuilder.New() + .AddQueryType() + .AddType() + .AddPolymorphicIds() + .Create() + .ToString(); + + // assert + await Verifier.Verify(schema); + } + [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Can't be static for HC")] public class Query { From 239babee61a60528b6d8fdf4c0e90ee7be25e5d7 Mon Sep 17 00:00:00 2001 From: Ben McCallum Date: Fri, 14 Jan 2022 11:00:48 +0100 Subject: [PATCH 3/4] Approve tests --- ...sts.Id_On_Objects_Given_Nulls.verified.txt | 3 +- ..._On_Arguments_isEnabled=False.verified.txt | 34 +++++++++---------- ...yId_On_Objects_isEnabled=True.verified.txt | 7 ++-- .../IdAttributeTests.Schema.verified.txt | 9 +++-- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Objects_Given_Nulls.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Objects_Given_Nulls.verified.txt index f3eb3db..f10e512 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Objects_Given_Nulls.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Id_On_Objects_Given_Nulls.verified.txt @@ -9,7 +9,8 @@ "QmFyCmkx" ], "someNullableIds": [ - "QmFyCmkx" + "QmFyCmkx", + null ] } } diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt index a45ec85..3a1641a 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Arguments_isEnabled=False.verified.txt @@ -1,52 +1,52 @@ -{ +{ "errors": [ { - "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, , 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." + "message": "The ID \u00601\u0060 has an invalid format." }, { - "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." + "message": "The ID \u00601\u0060 has an invalid format." }, { - "message": "The ID \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 has an invalid format." + "message": "The IDs \u00601\u0060 have an invalid format." }, { - "message": "The ID \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 has an invalid format." + "message": "The IDs \u00601, \u0060 have an invalid format." }, { - "message": "The IDs \u0060abc, \u0060 have an invalid format." + "message": "The ID \u00609223372036854775807\u0060 has an invalid format." }, { - "message": "The IDs \u0060abc\u0060 have an invalid format." + "message": "The ID \u00609223372036854775807\u0060 has an invalid format." }, { - "message": "The ID \u0060abc\u0060 has an invalid format." + "message": "The IDs \u00609223372036854775807\u0060 have an invalid format." }, { - "message": "The ID \u0060abc\u0060 has an invalid format." + "message": "The IDs \u00609223372036854775807, \u0060 have an invalid format." }, { - "message": "The IDs \u00609223372036854775807, \u0060 have an invalid format." + "message": "The ID \u0060abc\u0060 has an invalid format." }, { - "message": "The IDs \u00609223372036854775807\u0060 have an invalid format." + "message": "The ID \u0060abc\u0060 has an invalid format." }, { - "message": "The ID \u00609223372036854775807\u0060 has an invalid format." + "message": "The IDs \u0060abc\u0060 have an invalid format." }, { - "message": "The ID \u00609223372036854775807\u0060 has an invalid format." + "message": "The IDs \u0060abc, \u0060 have an invalid format." }, { - "message": "The IDs \u00601, \u0060 have an invalid format." + "message": "The ID \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 has an invalid format." }, { - "message": "The IDs \u00601\u0060 have an invalid format." + "message": "The ID \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 has an invalid format." }, { - "message": "The ID \u00601\u0060 has an invalid format." + "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." }, { - "message": "The ID \u00601\u0060 has an invalid format." + "message": "The IDs \u006026a2dc8f-4dab-408c-88c6-523a0a89a2b5, , 26a2dc8f-4dab-408c-88c6-523a0a89a2b5\u0060 have an invalid format." } ] } \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt index b33be42..a14a41a 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt @@ -1,4 +1,4 @@ -{ +{ "data": { "foo": { "someId": "QmFyCmQx", @@ -7,9 +7,10 @@ "QmFyCmkx" ], "someNullableIds": [ - "QmFyCmkx" + "QmFyCmkx", + null ], - "raw": "SomeId: 1, SomeIds: [1], SomeNullableId: 1, SomeNullableIds: [1]" + "raw": "SomeId: 1, SomeIds: [1], SomeNullableId: 1, SomeNullableIds: [1, ]" } } } \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt index 8621d45..3b0029e 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.Schema.verified.txt @@ -1,4 +1,4 @@ -schema { +schema { query: Query } @@ -36,6 +36,7 @@ type Query { nullableGuidId(id: ID): String! nullableGuidIdList(id: [ID]!): String! foo(input: FooInput!): IFooPayload! + lol(input: LolInput!): Int! } input FooInput { @@ -45,8 +46,12 @@ input FooInput { someNullableIds: [ID] } +input LolInput { + someId: Int! +} + "The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT "The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." -directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean!) on FIELD \ No newline at end of file +directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean) on FIELD \ No newline at end of file From dc42942c321b921da53cf20b369a04d4c246d137 Mon Sep 17 00:00:00 2001 From: Ben McCallum Date: Fri, 14 Jan 2022 11:12:42 +0100 Subject: [PATCH 4/4] Improve tests --- ...tributeTests.PolyId_On_Objects_isEnabled=True.verified.txt | 2 +- .../IdAttributeTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt index a14a41a..0fcc92b 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.PolyId_On_Objects_isEnabled=True.verified.txt @@ -10,7 +10,7 @@ "QmFyCmkx", null ], - "raw": "SomeId: 1, SomeIds: [1], SomeNullableId: 1, SomeNullableIds: [1, ]" + "raw": "SomeId: 1, SomeIds: [1], SomeNullableId: 1, SomeNullableIds: [1, null]" } } } \ No newline at end of file diff --git a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs index cb97aa9..2435b89 100644 --- a/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs +++ b/src/AutoGuru.HotChocolate.PolymorphicIds.Tests/IdAttributeTests.cs @@ -571,8 +571,8 @@ public FooPayload( public string Raw => $"{nameof(SomeId)}: {SomeId}, " + $"{nameof(SomeIds)}: [{string.Join(", ", SomeIds)}], " + - $"{nameof(SomeNullableId)}: {SomeNullableId}, " + - $"{nameof(SomeNullableIds)}: [{string.Join(", ", SomeNullableIds ?? Array.Empty())}]"; + $"{nameof(SomeNullableId)}: {SomeNullableId ?? "null"}, " + + $"{nameof(SomeNullableIds)}: {(SomeNullableIds == null ? "null" : "[" + string.Join(", ", SomeNullableIds.Select(x => x?.ToString() ?? "null").ToArray()) + "]")}"; } public interface IFooPayload