diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs index 462ba981f57..286295db9fe 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs @@ -225,6 +225,20 @@ private void AddDeserializeMethod( .AddCode(jsonElementNullCheck) .AddEmptyLine(); + // When deserializing arrays of nullable values (e.g. [User] => [ { ... }, null, { ... }]) the second + // element will be not null, but instead a JSON element of kind JsonValueKind.Null. + var jsonElementNullValueKindCheck = IfBuilder + .New() + .SetCondition($"{_obj}.Value.ValueKind == System.Text.Json.JsonValueKind.Null") + .AddCode( + typeReference.IsNonNull() + ? ExceptionBuilder.New(TypeNames.ArgumentNullException) + : CodeLineBuilder.From("return null;")); + + methodBuilder + .AddCode(jsonElementNullValueKindCheck) + .AddEmptyLine(); + AddDeserializeMethodBody(classBuilder, methodBuilder, typeReference, processed); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/AnyScalarDefaultSerializationTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/AnyScalarDefaultSerializationTest.Client.cs index b306f9d3ac0..d23379093cb 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/AnyScalarDefaultSerializationTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/AnyScalarDefaultSerializationTest.Client.cs @@ -383,6 +383,11 @@ public GetJsonBuilder(global::StrawberryShake.IEntityStore entityStore, global:: throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _anyParser.Parse(obj.Value!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.Client.cs index d6696ba4ef9..9d50e003786 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.Client.cs @@ -864,6 +864,11 @@ public GetFooBuilder(global::StrawberryShake.IEntityStore entityStore, global::S return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -880,6 +885,11 @@ public GetFooBuilder(global::StrawberryShake.IEntityStore entityStore, global::S return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -937,6 +947,11 @@ public GetFooBuilder(global::StrawberryShake.IEntityStore entityStore, global::S return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/MultiProfileTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/MultiProfileTest.Client.cs index 20fd799406d..d516ec36b23 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/MultiProfileTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/MultiProfileTest.Client.cs @@ -1905,6 +1905,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -1945,6 +1950,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1955,6 +1965,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1971,6 +1986,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1987,6 +2007,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -2058,6 +2083,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -2074,6 +2104,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -2084,6 +2119,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -2094,6 +2134,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -2137,6 +2182,11 @@ public CreateReviewMutBuilder(global::StrawberryShake.IEntityStore entityStore, throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -2153,6 +2203,11 @@ public CreateReviewMutBuilder(global::StrawberryShake.IEntityStore entityStore, throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -2163,6 +2218,11 @@ public CreateReviewMutBuilder(global::StrawberryShake.IEntityStore entityStore, return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferInListTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferInListTest.Client.cs index f6316b58afe..093eb9fc60d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferInListTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferInListTest.Client.cs @@ -1018,6 +1018,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -1058,6 +1063,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1074,6 +1084,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1090,6 +1105,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -1130,6 +1150,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferredTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferredTest.Client.cs index 530af57ebd0..a8d84baf7d1 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferredTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferredTest.Client.cs @@ -1027,6 +1027,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -1067,6 +1072,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1077,6 +1087,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1093,6 +1108,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1109,6 +1129,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsNoStoreTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsNoStoreTest.Client.cs index 78886de9528..c7e53f7d8e6 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsNoStoreTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsNoStoreTest.Client.cs @@ -881,6 +881,11 @@ public GetHeroBuilder(global::StrawberryShake.IOperationResultDataFactory(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsTest.Client.cs index 70705cb1e73..fe4081db1ea 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsTest.Client.cs @@ -917,6 +917,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -957,6 +962,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -967,6 +977,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -983,6 +998,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -999,6 +1019,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTest.Client.cs index a95a5456972..c4f7ecfc50e 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTest.Client.cs @@ -609,6 +609,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -649,6 +654,11 @@ public GetHeroBuilder(global::StrawberryShake.IEntityStore entityStore, global:: throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsIntrospectionTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsIntrospectionTest.Client.cs index aa51acab41e..387648efce5 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsIntrospectionTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsIntrospectionTest.Client.cs @@ -3832,6 +3832,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Schema", global::System.StringComparison.Ordinal) ?? false) { @@ -3848,6 +3853,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3864,6 +3874,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3874,6 +3889,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3890,6 +3910,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3906,6 +3931,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3922,6 +3952,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3938,6 +3973,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return ___TypeKindParser.Parse(obj.Value.GetString()!); } @@ -3948,6 +3988,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Fields = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3964,6 +4009,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Field", global::System.StringComparison.Ordinal) ?? false) { @@ -3980,6 +4030,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3990,6 +4045,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4006,6 +4066,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { @@ -4022,6 +4087,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4038,6 +4108,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4054,6 +4129,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4070,6 +4150,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4086,6 +4171,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4102,6 +4192,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4112,6 +4207,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4128,6 +4228,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { @@ -4144,6 +4249,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4160,6 +4270,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4176,6 +4291,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __EnumValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4192,6 +4312,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__EnumValue", global::System.StringComparison.Ordinal) ?? false) { @@ -4208,6 +4333,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4224,6 +4354,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4240,6 +4375,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __Directives = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4256,6 +4396,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Directive", global::System.StringComparison.Ordinal) ?? false) { @@ -4272,6 +4417,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4288,6 +4438,11 @@ public IntrospectionQueryBuilder(global::StrawberryShake.IEntityStore entityStor throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubCompletionTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubCompletionTest.Client.cs index 618c3d16bb2..1487245c568 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubCompletionTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubCompletionTest.Client.cs @@ -558,6 +558,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -574,6 +579,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -584,6 +594,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -594,6 +609,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IEntityStore entityStore, glob return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubNoStoreTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubNoStoreTest.Client.cs index f83c66b04d9..6cd22a59c76 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubNoStoreTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubNoStoreTest.Client.cs @@ -478,6 +478,11 @@ public OnReviewSubBuilder(global::StrawberryShake.IOperationResultDataFactory(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -753,6 +758,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Starship", global::System.StringComparison.Ordinal)) @@ -807,6 +817,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsUnionListTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsUnionListTest.Client.cs index 2e4f210f2a2..fb728bb4056 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsUnionListTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsUnionListTest.Client.cs @@ -1031,6 +1031,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var searchResults = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1047,6 +1052,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Starship", global::System.StringComparison.Ordinal)) @@ -1101,6 +1111,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1111,6 +1126,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1127,6 +1147,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1143,6 +1168,11 @@ public SearchHeroBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.Client.cs index 795e4864486..fad4bb5a763 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.Client.cs @@ -1071,6 +1071,11 @@ public TestUploadBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.Client.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.Client.cs index 0a7365eb561..2babe1bfe28 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.Client.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.Client.cs @@ -1071,6 +1071,11 @@ public TestUploadBuilder(global::StrawberryShake.IEntityStore entityStore, globa return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Combined.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Combined.snap index 145d30aa307..aa481dcb02f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Combined.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Combined.snap @@ -1091,6 +1091,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1117,6 +1122,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1158,6 +1168,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1184,6 +1199,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1225,6 +1245,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1251,6 +1276,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_DifferentTransportMethods.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_DifferentTransportMethods.snap index da85f504af1..43688793dbf 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_DifferentTransportMethods.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_DifferentTransportMethods.snap @@ -1091,6 +1091,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1117,6 +1122,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1158,6 +1168,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1184,6 +1199,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1225,6 +1245,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1251,6 +1276,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_InMemory.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_InMemory.snap index a507abff05f..3d759f3b3c3 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_InMemory.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_InMemory.snap @@ -1091,6 +1091,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1117,6 +1122,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1158,6 +1168,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1184,6 +1199,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1225,6 +1245,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1251,6 +1276,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_MultiProfile.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_MultiProfile.snap index 0aff76408f1..b3e74114be5 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_MultiProfile.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_MultiProfile.snap @@ -1099,6 +1099,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1125,6 +1130,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1166,6 +1176,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1192,6 +1207,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1233,6 +1253,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1259,6 +1284,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Mutation.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Mutation.snap index 7f1bde0e43d..d0f0c4eff52 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Mutation.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Mutation.snap @@ -426,6 +426,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -452,6 +457,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Query.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Query.snap index 7e8053efba2..201cb556eda 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Query.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Query.snap @@ -426,6 +426,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -452,6 +457,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Subscription.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Subscription.snap index 9ec4a53ccbd..bb5a58f0d1a 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Subscription.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/DependencyInjectionGeneratorTests.Default_Subscription.snap @@ -419,6 +419,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -445,6 +450,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes.snap index 005f6df72b6..79cf0642696 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes.snap @@ -711,6 +711,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("SearchableStore", global::System.StringComparison.Ordinal)) @@ -737,6 +742,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -747,6 +757,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var books = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -763,6 +778,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Book", global::System.StringComparison.Ordinal) ?? false) { @@ -779,6 +799,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Author", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes_With_Records.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes_With_Records.snap index d76ce19170b..0aea7465f64 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes_With_Records.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataInEntity_UnionDataTypes_With_Records.snap @@ -711,6 +711,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("SearchableStore", global::System.StringComparison.Ordinal)) @@ -737,6 +742,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -747,6 +757,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var books = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -763,6 +778,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Book", global::System.StringComparison.Ordinal) ?? false) { @@ -779,6 +799,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Author", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes.snap index 10b231102b3..59bc26ccce6 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes.snap @@ -532,6 +532,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var prints = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -548,6 +553,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Book", global::System.StringComparison.Ordinal) ?? false) { @@ -569,6 +579,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -579,6 +594,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes_With_Records.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes_With_Records.snap index 216529fd282..8e522b0b726 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes_With_Records.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_InterfaceDataTypes_With_Records.snap @@ -532,6 +532,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var prints = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -548,6 +553,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Book", global::System.StringComparison.Ordinal) ?? false) { @@ -569,6 +579,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -579,6 +594,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes.snap index c81076ffbe9..3fff2175e3d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes.snap @@ -494,6 +494,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Author", global::System.StringComparison.Ordinal) ?? false) { @@ -515,6 +520,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes_With_Records.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes_With_Records.snap index bad2899ee05..780c7a34ae1 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes_With_Records.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_BookClient_DataOnly_UnionDataTypes_With_Records.snap @@ -494,6 +494,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Author", global::System.StringComparison.Ordinal) ?? false) { @@ -515,6 +520,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity.snap index bbb5ce99ec8..64cc912d5ec 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity.snap @@ -643,6 +643,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -659,6 +664,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -675,6 +685,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -701,6 +716,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -711,6 +731,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity_With_Records.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity_With_Records.snap index 5ce2b10205d..c9d0896c781 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity_With_Records.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_ConnectionNotAnEntity_With_Records.snap @@ -643,6 +643,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -659,6 +664,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -675,6 +685,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -701,6 +716,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -711,6 +731,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly.snap index bc67ffa0664..3c15f44ec0b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly.snap @@ -1728,6 +1728,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1744,6 +1749,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1760,6 +1770,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1786,6 +1801,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1796,6 +1816,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("MessageConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1812,6 +1837,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var messages = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1828,6 +1858,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -1854,6 +1889,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1911,6 +1951,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("SendMessagePayload", global::System.StringComparison.Ordinal) ?? false) { @@ -1927,6 +1972,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -1953,6 +2003,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1979,6 +2034,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly_With_Records.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly_With_Records.snap index 3884fb52196..61de51f4d49 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly_With_Records.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityGeneratorTests.Generate_ChatClient_MapperMapsEntityOnRootCorrectly_With_Records.snap @@ -1728,6 +1728,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1744,6 +1749,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1760,6 +1770,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1786,6 +1801,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1796,6 +1816,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("MessageConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1812,6 +1837,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var messages = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1828,6 +1858,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -1854,6 +1889,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1911,6 +1951,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("SendMessagePayload", global::System.StringComparison.Ordinal) ?? false) { @@ -1927,6 +1972,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -1953,6 +2003,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1979,6 +2034,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_ComplexEntity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_ComplexEntity.snap index 84126069bb3..d0429ceaaa7 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_ComplexEntity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_ComplexEntity.snap @@ -445,6 +445,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -471,6 +476,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -481,6 +491,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_DateTimeOffset_Entity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_DateTimeOffset_Entity.snap index 80aca89b45c..d78307d28eb 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_DateTimeOffset_Entity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_DateTimeOffset_Entity.snap @@ -444,6 +444,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -470,6 +475,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } @@ -480,6 +490,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_IdEntity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_IdEntity.snap index 8dc6962c560..449addfb326 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_IdEntity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_IdEntity.snap @@ -442,6 +442,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -468,6 +473,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -478,6 +488,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_NoEntity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_NoEntity.snap index 02e80b27bc6..cc213755caf 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_NoEntity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_NoEntity.snap @@ -419,6 +419,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -435,6 +440,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -445,6 +455,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_Uuid_Entity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_Uuid_Entity.snap index 0292ce08da0..42c137459fb 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_Uuid_Entity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityIdFactoryGeneratorTests.Simple_Uuid_Entity.snap @@ -444,6 +444,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -470,6 +475,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -480,6 +490,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceField.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceField.snap index c15070775e0..e8eb2506556 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceField.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceField.snap @@ -797,6 +797,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -854,6 +859,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceList.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceList.snap index 5ea1c29a062..9eadffd364c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceList.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.InterfaceList.snap @@ -819,6 +819,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -835,6 +840,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -892,6 +902,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.NonNullableValueTypeId.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.NonNullableValueTypeId.snap index fc0a1aa0727..e3a37258eda 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.NonNullableValueTypeId.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.NonNullableValueTypeId.snap @@ -771,6 +771,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -787,6 +792,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -844,6 +854,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionField.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionField.snap index 8cada122ea3..42bf3e9ab9a 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionField.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionField.snap @@ -755,6 +755,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -812,6 +817,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionList.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionList.snap index 3cf253c5dae..33cc61dd41c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionList.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionList.snap @@ -777,6 +777,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -793,6 +798,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -850,6 +860,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionListInEntity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionListInEntity.snap index 3da6146de11..f75e2e44b0a 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionListInEntity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionListInEntity.snap @@ -818,6 +818,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Test", global::System.StringComparison.Ordinal)) @@ -844,6 +849,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -860,6 +870,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -917,6 +932,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionWithNestedObject.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionWithNestedObject.snap index 67f32684dd4..de9128d6772 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionWithNestedObject.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/EntityOrIdGeneratorTests.UnionWithNestedObject.snap @@ -902,6 +902,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("UserSettingSuccess", global::System.StringComparison.Ordinal) ?? false) { @@ -936,6 +941,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -946,6 +956,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var errorNodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -962,6 +977,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ErrorNode", global::System.StringComparison.Ordinal) ?? false) { @@ -978,6 +998,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _errorCodeParser.Parse(obj.Value.GetString()!); } @@ -988,6 +1013,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_ChatClient_InvalidNullCheck.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_ChatClient_InvalidNullCheck.snap index a055482d126..db519dbd2a6 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_ChatClient_InvalidNullCheck.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_ChatClient_InvalidNullCheck.snap @@ -714,6 +714,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -740,6 +745,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -756,6 +766,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -772,6 +787,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -798,6 +818,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -808,6 +833,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_NoErrors.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_NoErrors.snap index b467ea75688..fea2a551595 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_NoErrors.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ErrorGeneratorTests.Generate_NoErrors.snap @@ -598,6 +598,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -638,6 +643,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -648,6 +658,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -664,6 +679,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Input_Type_Fields_Are_Inspected_For_LeafTypes.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Input_Type_Fields_Are_Inspected_For_LeafTypes.snap index 88076646b3a..ee55f73bf2c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Input_Type_Fields_Are_Inspected_For_LeafTypes.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Input_Type_Fields_Are_Inspected_For_LeafTypes.snap @@ -702,6 +702,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ChangeHomePlanetPayload", global::System.StringComparison.Ordinal) ?? false) { @@ -718,6 +723,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Human", global::System.StringComparison.Ordinal)) @@ -744,6 +754,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.KeywordCollisions.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.KeywordCollisions.snap index 184e5ef8eb8..01bb9005205 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.KeywordCollisions.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.KeywordCollisions.snap @@ -713,6 +713,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("readonly", global::System.StringComparison.Ordinal) ?? false) { @@ -729,6 +734,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -739,6 +749,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("readonlyEntity", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Comments.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Comments.snap index 5886a1e3149..5cb61d25b88 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Comments.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Comments.snap @@ -699,6 +699,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_ComplexInputTypes.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_ComplexInputTypes.snap index 52f00a09c81..ef1462e3a1d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_ComplexInputTypes.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_ComplexInputTypes.snap @@ -1001,6 +1001,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Complex_Arguments.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Complex_Arguments.snap index d9de2822bb9..9dd2969a992 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Complex_Arguments.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_Complex_Arguments.snap @@ -693,6 +693,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_FirstNonUpload.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_FirstNonUpload.snap index 7fd03562785..4c4b9f6bca6 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_FirstNonUpload.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_FirstNonUpload.snap @@ -333,6 +333,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_LastNonUpload.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_LastNonUpload.snap index 476ec23e407..aced27a01b7 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_LastNonUpload.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_LastNonUpload.snap @@ -333,6 +333,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadAsArg.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadAsArg.snap index 6c9b2617f6f..13089423c56 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadAsArg.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadAsArg.snap @@ -492,6 +492,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInDeepInputObject.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInDeepInputObject.snap index b1a6881fac8..c83c0fa875c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInDeepInputObject.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInDeepInputObject.snap @@ -844,6 +844,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInInputObject.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInInputObject.snap index dd52d5a0213..9b2c6472686 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInInputObject.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InputGeneratorTests.Operation_With_UploadInInputObject.snap @@ -451,6 +451,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap index ac1070ce09f..58a33141eff 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap @@ -688,6 +688,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -704,6 +709,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } @@ -733,6 +743,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -749,6 +764,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Default_Names.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Default_Names.snap index d78a8b6b529..9836198efb0 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Default_Names.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Default_Names.snap @@ -527,6 +527,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Droid", global::System.StringComparison.Ordinal) ?? false) { @@ -548,6 +553,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -558,6 +568,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -574,6 +589,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap index 37fc84ff994..a200174f648 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap @@ -895,6 +895,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Droid", global::System.StringComparison.Ordinal) ?? false) { @@ -916,6 +921,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -926,6 +936,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -936,6 +951,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -952,6 +972,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Leaf_Argument.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Leaf_Argument.snap index e9ebacc034b..acff9f84612 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Leaf_Argument.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Leaf_Argument.snap @@ -543,6 +543,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Droid", global::System.StringComparison.Ordinal) ?? false) { @@ -564,6 +569,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -574,6 +584,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -590,6 +605,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Type_Argument.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Type_Argument.snap index 1065c6ddd31..00d63616cf8 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Type_Argument.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Operation_With_Type_Argument.snap @@ -605,6 +605,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -621,6 +626,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -631,6 +641,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap index 4d846a02d33..3538d93c94e 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap @@ -557,6 +557,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var searchResults = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -573,6 +578,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Starship", global::System.StringComparison.Ordinal) ?? false) { @@ -599,6 +609,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsUnionList.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsUnionList.snap index 8f24d5fdd86..ad8f01decfb 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsUnionList.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.StarWarsUnionList.snap @@ -563,6 +563,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var searchResults = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -579,6 +584,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Starship", global::System.StringComparison.Ordinal) ?? false) { @@ -605,6 +615,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Subscription_With_Default_Names.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Subscription_With_Default_Names.snap index 56a726fefe9..7f20d62a5f1 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Subscription_With_Default_Names.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/NoStoreStarWarsGeneratorTests.Subscription_With_Default_Names.snap @@ -384,6 +384,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -400,6 +405,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -410,6 +420,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Generate_ChatClient_AllOperations.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Generate_ChatClient_AllOperations.snap index 4bb8337b8aa..675584bb68e 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Generate_ChatClient_AllOperations.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Generate_ChatClient_AllOperations.snap @@ -4257,6 +4257,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -4273,6 +4278,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4289,6 +4299,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4315,6 +4330,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -4325,6 +4345,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4335,6 +4360,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _urlParser.Parse(obj.Value.GetString()!); } @@ -4345,6 +4375,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } } @@ -4394,6 +4429,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4420,6 +4460,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("MessageConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -4436,6 +4481,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var messages = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4452,6 +4502,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -4478,6 +4533,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -4488,6 +4548,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _directionParser.Parse(obj.Value.GetString()!); } @@ -4498,6 +4563,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4524,6 +4594,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4534,6 +4609,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4560,6 +4640,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } } @@ -4609,6 +4694,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("SendMessagePayload", global::System.StringComparison.Ordinal) ?? false) { @@ -4625,6 +4715,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -4651,6 +4746,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -4661,6 +4761,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _directionParser.Parse(obj.Value.GetString()!); } @@ -4671,6 +4776,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4697,6 +4807,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4707,6 +4822,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4733,6 +4853,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } } @@ -4782,6 +4907,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("SendMessagePayload", global::System.StringComparison.Ordinal) ?? false) { @@ -4798,6 +4928,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -4824,6 +4959,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -4834,6 +4974,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _directionParser.Parse(obj.Value.GetString()!); } @@ -4844,6 +4989,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4870,6 +5020,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4880,6 +5035,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -4906,6 +5066,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } } @@ -4955,6 +5120,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Message", global::System.StringComparison.Ordinal)) @@ -4981,6 +5151,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -4991,6 +5166,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _directionParser.Parse(obj.Value.GetString()!); } @@ -5001,6 +5181,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -5027,6 +5212,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -5037,6 +5227,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -5063,6 +5258,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullableValueType_WithoutGlobal_Input.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullableValueType_WithoutGlobal_Input.snap index bc3894f8175..7cc5d64602c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullableValueType_WithoutGlobal_Input.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullableValueType_WithoutGlobal_Input.snap @@ -436,6 +436,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullable_ValueType_Input.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullable_ValueType_Input.snap index bc3894f8175..7cc5d64602c 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullable_ValueType_Input.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.NonNullable_ValueType_Input.snap @@ -436,6 +436,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_List_Input.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_List_Input.snap index ff219231399..16f7c540672 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_List_Input.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_List_Input.snap @@ -591,6 +591,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_ValueType_Input.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_ValueType_Input.snap index 99eb94e21cc..f258b3f5679 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_ValueType_Input.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Nullable_ValueType_Input.snap @@ -447,6 +447,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Operation_With_MultipleOperations.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Operation_With_MultipleOperations.snap index 3af51b947ae..afe2655ebd5 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Operation_With_MultipleOperations.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Operation_With_MultipleOperations.snap @@ -1291,6 +1291,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1330,6 +1335,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -1369,6 +1379,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Response_Name_Is_Correctly_Cased.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Response_Name_Is_Correctly_Cased.snap index 108f89da0c1..ce62467faff 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Response_Name_Is_Correctly_Cased.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/OperationGeneratorTests.Response_Name_Is_Correctly_Cased.snap @@ -302,6 +302,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/PersistedQueryGeneratorTests.Simple_Custom_Scalar.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/PersistedQueryGeneratorTests.Simple_Custom_Scalar.snap index 3f49b3a8ea6..c526c34a867 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/PersistedQueryGeneratorTests.Simple_Custom_Scalar.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/PersistedQueryGeneratorTests.Simple_Custom_Scalar.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Nested_Entity.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Nested_Entity.snap index 3cbe22114e7..d68e8dd4641 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Nested_Entity.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Nested_Entity.snap @@ -843,6 +843,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("DecodeVIN", global::System.StringComparison.Ordinal) ?? false) { @@ -859,6 +864,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -869,6 +879,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("VehicleMake", global::System.StringComparison.Ordinal)) @@ -895,6 +910,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -905,6 +925,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -915,6 +940,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("VehicleModel", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Comments.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Comments.snap index cafeff7c5f8..fd7d91b36b1 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Comments.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Comments.snap @@ -921,6 +921,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -937,6 +942,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -947,6 +957,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -957,6 +972,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -973,6 +993,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var bazs = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -989,6 +1014,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -1005,6 +1035,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bazs = new global::System.Collections.Generic.List?>(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1021,6 +1056,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bazs = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1037,6 +1077,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Complex_Types.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Complex_Types.snap index 25f2d753bbb..ef9d1397b73 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Complex_Types.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_Complex_Types.snap @@ -837,6 +837,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -853,6 +858,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -863,6 +873,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -873,6 +888,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -889,6 +909,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var bazs = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -905,6 +930,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { @@ -921,6 +951,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bazs = new global::System.Collections.Generic.List?>(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -937,6 +972,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bazs = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -953,6 +993,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_NullableData.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_NullableData.snap index a47632b644c..8c2a1af6a34 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_NullableData.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ResultTypeGeneratorTests.Operation_With_NullableData.snap @@ -573,6 +573,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FooNotification", global::System.StringComparison.Ordinal) ?? false) { @@ -589,6 +594,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -599,6 +609,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FooNotificationData", global::System.StringComparison.Ordinal) ?? false) { @@ -615,6 +630,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Scalar.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Scalar.snap index 6cdf98cdb71..841d993b0ad 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Scalar.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Scalar.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _anyParser.Parse(obj.Value!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Type.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Type.snap index e8c2eed7e59..965e1c68b9f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Type.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Any_Type.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _anyParser.Parse(obj.Value!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.ByteArray_ScalarType.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.ByteArray_ScalarType.snap index eba26a1ad9d..a91c88263e8 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.ByteArray_ScalarType.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.ByteArray_ScalarType.snap @@ -298,6 +298,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _byteArrayParser.Parse(obj.Value.GetBytesFromBase64()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Complete_Schema_With_Uuid_And_DateTime.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Complete_Schema_With_Uuid_And_DateTime.snap index c5bd10c2260..493c7de34e9 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Complete_Schema_With_Uuid_And_DateTime.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Complete_Schema_With_Uuid_And_DateTime.snap @@ -747,6 +747,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var expenses = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -763,6 +768,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Expense", global::System.StringComparison.Ordinal)) @@ -789,6 +799,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -799,6 +814,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _decimalParser.Parse(obj.Value.GetDecimal()!); } @@ -809,6 +829,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } @@ -819,6 +844,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -829,6 +859,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _expenseCategoryParser.Parse(obj.Value.GetString()!); } @@ -839,6 +874,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _paymentMethodParser.Parse(obj.Value.GetString()!); } @@ -849,6 +889,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var tags = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -865,6 +910,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Tag", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType.snap index 5d7c4b44625..cc9db4ce79b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType_ValueType_AsInput.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType_ValueType_AsInput.snap index e4591bbc26f..c2c4dea7133 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType_ValueType_AsInput.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_RuntimeType_ValueType_AsInput.snap @@ -415,6 +415,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -431,6 +436,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType.snap index 2a6f48a13e0..a4a94de16e8 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType_And_RuntimeType.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType_And_RuntimeType.snap index c7a290000ba..fee99dcbb4b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType_And_RuntimeType.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_SerializationType_And_RuntimeType.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_Unknown_RuntimeType.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_Unknown_RuntimeType.snap index a7f62e32bc3..156ebe55761 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_Unknown_RuntimeType.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Custom_Scalar_With_Unknown_RuntimeType.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Only_Custom_Scalars.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Only_Custom_Scalars.snap index 13020ca6ee5..a7a2f4106b8 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Only_Custom_Scalars.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Only_Custom_Scalars.snap @@ -410,6 +410,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -426,6 +431,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Scalars_Are_Correctly_Inferred.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Scalars_Are_Correctly_Inferred.snap index 81c65099635..7ab8ac08f72 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Scalars_Are_Correctly_Inferred.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Scalars_Are_Correctly_Inferred.snap @@ -454,6 +454,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var offers = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -470,6 +475,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Offer", global::System.StringComparison.Ordinal) ?? false) { @@ -486,6 +496,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _floatParser.Parse(obj.Value.GetDouble()!); } @@ -496,6 +511,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Simple_Custom_Scalar.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Simple_Custom_Scalar.snap index a2ab48d9cfc..2b7926a52ae 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Simple_Custom_Scalar.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Simple_Custom_Scalar.snap @@ -421,6 +421,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -437,6 +442,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -447,6 +457,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _emailParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.TimeSpan_Not_Detected.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.TimeSpan_Not_Detected.snap index e666bc7f722..621bf6fe183 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.TimeSpan_Not_Detected.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.TimeSpan_Not_Detected.snap @@ -563,6 +563,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("SessionConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -579,6 +584,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var sessions = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -595,6 +605,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Session", global::System.StringComparison.Ordinal)) @@ -621,6 +636,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uri_Type.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uri_Type.snap index bffb93c240e..2d23af10515 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uri_Type.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uri_Type.snap @@ -425,6 +425,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -441,6 +446,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _uriParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uuid_Type.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uuid_Type.snap index 8720900ad28..a0842c2e3e5 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uuid_Type.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/ScalarGeneratorTests.Uuid_Type.snap @@ -425,6 +425,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Person", global::System.StringComparison.Ordinal) ?? false) { @@ -441,6 +446,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _uuidParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_DataType_Query.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_DataType_Query.snap index 5975debd58a..8a4dc62279b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_DataType_Query.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_DataType_Query.snap @@ -520,6 +520,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var foos = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -536,6 +541,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Foo", global::System.StringComparison.Ordinal) ?? false) { @@ -552,6 +562,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Profile", global::System.StringComparison.Ordinal) ?? false) { @@ -568,6 +583,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatById.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatById.snap index 046ac6fa1b4..151d8ffe6af 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatById.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatById.snap @@ -742,6 +742,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FeatCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -758,6 +763,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var feats = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -774,6 +784,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Feat", global::System.StringComparison.Ordinal)) @@ -800,6 +815,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -810,6 +830,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -820,6 +845,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -830,6 +860,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var featDetailsBlocks = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -846,6 +881,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("FeatDetailsBlock", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatsPage.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatsPage.snap index c0b81bf670a..83e00980931 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatsPage.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_GetFeatsPage.snap @@ -742,6 +742,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FeatCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -758,6 +763,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var feats = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -774,6 +784,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Feat", global::System.StringComparison.Ordinal)) @@ -800,6 +815,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -810,6 +830,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -820,6 +845,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -830,6 +860,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("ActionType", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_PeopleSearch_From_ActiveDirectory_Schema.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_PeopleSearch_From_ActiveDirectory_Schema.snap index 5edd5352893..0cfb8c72b6f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_PeopleSearch_From_ActiveDirectory_Schema.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_PeopleSearch_From_ActiveDirectory_Schema.snap @@ -1229,6 +1229,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("PersonCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -1245,6 +1250,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -1255,6 +1265,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("CollectionSegmentInfo", global::System.StringComparison.Ordinal) ?? false) { @@ -1271,6 +1286,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -1281,6 +1301,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var persons = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1297,6 +1322,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) @@ -1323,6 +1353,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -1333,6 +1368,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _longParser.Parse(obj.Value.GetInt64()!); } @@ -1343,6 +1383,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -1353,6 +1398,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Department", global::System.StringComparison.Ordinal)) @@ -1379,6 +1429,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _urlParser.Parse(obj.Value.GetString()!); } @@ -1389,6 +1444,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Person", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_Query_With_Skip_Take.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_Query_With_Skip_Take.snap index ac721491876..5552886d9cc 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_Query_With_Skip_Take.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_Query_With_Skip_Take.snap @@ -626,6 +626,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("NewsItemCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -642,6 +647,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var newsItems = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -658,6 +668,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("NewsItem", global::System.StringComparison.Ordinal)) @@ -684,6 +699,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_UpdateMembers_Mutation.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_UpdateMembers_Mutation.snap index 330a0df66b5..ebe59d0f1d3 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_UpdateMembers_Mutation.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Create_UpdateMembers_Mutation.snap @@ -911,6 +911,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ProjectMutations", global::System.StringComparison.Ordinal) ?? false) { @@ -927,6 +932,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("MutationResult", global::System.StringComparison.Ordinal) ?? false) { @@ -943,6 +953,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _guidParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.FieldsWithUnderlineInName.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.FieldsWithUnderlineInName.snap index 49acbcdebe9..21b866718a3 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.FieldsWithUnderlineInName.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.FieldsWithUnderlineInName.snap @@ -3710,6 +3710,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Bwr_TimeSeriesConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -3726,6 +3731,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bwr_TimeSeriess = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3742,6 +3752,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("bwr_TimeSeries", global::System.StringComparison.Ordinal)) @@ -3768,6 +3783,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3778,6 +3798,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Resolution", global::System.StringComparison.Ordinal) ?? false) { @@ -3794,6 +3819,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _timeUnitParser.Parse(obj.Value.GetString()!); } @@ -3804,6 +3834,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -3814,6 +3849,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("bwr_ValidationCriteria", global::System.StringComparison.Ordinal)) @@ -3840,6 +3880,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _decimalParser.Parse(obj.Value.GetDecimal()!); } @@ -3850,6 +3895,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("bwr_ImportSpecification", global::System.StringComparison.Ordinal)) @@ -3876,6 +3926,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -3886,6 +3941,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var dataPoints = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3902,6 +3962,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("DataPoint", global::System.StringComparison.Ordinal) ?? false) { @@ -3918,6 +3983,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dateTimeParser.Parse(obj.Value.GetString()!); } @@ -3928,6 +3998,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _floatParser.Parse(obj.Value.GetDouble()!); } @@ -3938,6 +4013,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _dataFlagParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Full_Extension_File.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Full_Extension_File.snap index 65cf35c317d..add70198c79 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Full_Extension_File.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Full_Extension_File.snap @@ -430,6 +430,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ListingsPayload", global::System.StringComparison.Ordinal) ?? false) { @@ -446,6 +451,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.HasuraMutation.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.HasuraMutation.snap index d3ca1b545a1..fb9e087d662 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.HasuraMutation.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.HasuraMutation.snap @@ -3928,6 +3928,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("people_mutation_response", global::System.StringComparison.Ordinal) ?? false) { @@ -3944,6 +3949,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.IntrospectionQuery.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.IntrospectionQuery.snap index 517701e34b6..19c5a02ede9 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.IntrospectionQuery.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.IntrospectionQuery.snap @@ -3746,6 +3746,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Schema", global::System.StringComparison.Ordinal) ?? false) { @@ -3762,6 +3767,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3778,6 +3788,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3788,6 +3803,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3804,6 +3824,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3820,6 +3845,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3836,6 +3866,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3852,6 +3887,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return ___TypeKindParser.Parse(obj.Value.GetString()!); } @@ -3862,6 +3902,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Fields = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3878,6 +3923,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Field", global::System.StringComparison.Ordinal) ?? false) { @@ -3894,6 +3944,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3904,6 +3959,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3920,6 +3980,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { @@ -3936,6 +4001,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3952,6 +4022,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3968,6 +4043,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -3984,6 +4064,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4000,6 +4085,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4016,6 +4106,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -4026,6 +4121,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4042,6 +4142,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { @@ -4058,6 +4163,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4074,6 +4184,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4090,6 +4205,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __EnumValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4106,6 +4226,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__EnumValue", global::System.StringComparison.Ordinal) ?? false) { @@ -4122,6 +4247,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var __Types = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4138,6 +4268,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Type", global::System.StringComparison.Ordinal) ?? false) { @@ -4154,6 +4289,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __Directives = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4170,6 +4310,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__Directive", global::System.StringComparison.Ordinal) ?? false) { @@ -4186,6 +4331,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var __InputValues = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -4202,6 +4352,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("__InputValue", global::System.StringComparison.Ordinal) ?? false) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.LowerCaseScalarArgument.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.LowerCaseScalarArgument.snap index a9977e51edf..55ae2eae219 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.LowerCaseScalarArgument.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.LowerCaseScalarArgument.snap @@ -485,6 +485,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("people", global::System.StringComparison.Ordinal)) @@ -511,6 +516,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uuidParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.MultiLineDocumentation.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.MultiLineDocumentation.snap index d7df6443e2d..d6da4b0d32e 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.MultiLineDocumentation.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.MultiLineDocumentation.snap @@ -314,6 +314,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NodeTypenameCollision.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NodeTypenameCollision.snap index 2725eadb3fb..043a30ef02d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NodeTypenameCollision.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NodeTypenameCollision.snap @@ -455,6 +455,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Workspace", global::System.StringComparison.Ordinal)) @@ -481,6 +486,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NonNullLists.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NonNullLists.snap index 3ae379b93d4..d7e8833f80e 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NonNullLists.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.NonNullLists.snap @@ -576,6 +576,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var listings = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -592,6 +597,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Offer", global::System.StringComparison.Ordinal) ?? false) { @@ -608,6 +618,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var amenitys = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -624,6 +639,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _amenityParser.Parse(obj.Value.GetString()!); } @@ -634,6 +654,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var amenitys = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -650,6 +675,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var amenitys = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -666,6 +696,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _amenityParser.Parse(obj.Value.GetString()!); } @@ -676,6 +711,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var amenitys = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -692,6 +732,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var amenitys = new global::System.Collections.Generic.List>(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -708,6 +753,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var amenitys = new global::System.Collections.Generic.List>(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -724,6 +774,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var amenitys = new global::System.Collections.Generic.List?>(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.QueryInterference.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.QueryInterference.snap index 31286b8c26c..4c9fe5e9eb9 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.QueryInterference.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.QueryInterference.snap @@ -3125,6 +3125,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FeatCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -3141,6 +3146,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -3151,6 +3161,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var feats = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3167,6 +3182,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Feat", global::System.StringComparison.Ordinal)) @@ -3193,6 +3213,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -3203,6 +3228,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3213,6 +3243,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _booleanParser.Parse(obj.Value.GetBoolean()!); } @@ -3223,6 +3258,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var featDetailsBlocks = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3239,6 +3279,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("FeatDetailsBlock", global::System.StringComparison.Ordinal)) @@ -3300,6 +3345,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FeatCollectionSegment", global::System.StringComparison.Ordinal) ?? false) { @@ -3316,6 +3366,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var feats = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3332,6 +3387,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Feat", global::System.StringComparison.Ordinal)) @@ -3358,6 +3418,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _uUIDParser.Parse(obj.Value.GetString()!); } @@ -3368,6 +3433,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3378,6 +3448,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -3388,6 +3463,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -3398,6 +3478,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var featDetailsBlocks = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -3414,6 +3499,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("FeatDetailsBlock", global::System.StringComparison.Ordinal)) @@ -3440,6 +3530,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("ActionType", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Query_With_Nested_Fragments.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Query_With_Nested_Fragments.snap index 46deaedce7a..d8c3cc6066f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Query_With_Nested_Fragments.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Query_With_Nested_Fragments.snap @@ -688,6 +688,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ListingsPayload", global::System.StringComparison.Ordinal) ?? false) { @@ -704,6 +709,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var listings = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -720,6 +730,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Auction", global::System.StringComparison.Ordinal) ?? false) { @@ -741,6 +756,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _iDParser.Parse(obj.Value.GetString()!); } @@ -751,6 +771,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Schema_With_Spec_Errors.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Schema_With_Spec_Errors.snap index 65cf35c317d..add70198c79 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Schema_With_Spec_Errors.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.Schema_With_Spec_Errors.snap @@ -430,6 +430,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("ListingsPayload", global::System.StringComparison.Ordinal) ?? false) { @@ -446,6 +451,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_Client_With_Internal_Access_Modifier.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_Client_With_Internal_Access_Modifier.snap index 919d32b2d5f..01fe56e83dd 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_Client_With_Internal_Access_Modifier.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_Client_With_Internal_Access_Modifier.snap @@ -598,6 +598,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -638,6 +643,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -648,6 +658,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -664,6 +679,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap index 1ad1f08fecb..cf12447a3de 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Generate_StarWarsIntegrationTest.snap @@ -720,6 +720,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -736,6 +741,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } @@ -775,6 +785,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -791,6 +806,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Default_Names.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Default_Names.snap index b467ea75688..fea2a551595 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Default_Names.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Default_Names.snap @@ -598,6 +598,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -638,6 +643,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -648,6 +658,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -664,6 +679,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap index 289277cb93c..72a6a17c771 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Interface_With_Fragment_Definition_Two_Models.snap @@ -930,6 +930,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -970,6 +975,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -980,6 +990,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -990,6 +1005,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("FriendsConnection", global::System.StringComparison.Ordinal) ?? false) { @@ -1006,6 +1026,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var characters = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -1022,6 +1047,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Leaf_Argument.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Leaf_Argument.snap index c4d95733363..bb1e777d814 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Leaf_Argument.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Leaf_Argument.snap @@ -614,6 +614,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Droid", global::System.StringComparison.Ordinal)) @@ -654,6 +659,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -664,6 +674,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var episodes = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -680,6 +695,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _episodeParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Type_Argument.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Type_Argument.snap index 48e44e599b6..40632786d68 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Type_Argument.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Operation_With_Type_Argument.snap @@ -626,6 +626,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -642,6 +647,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -652,6 +662,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap index 7fe567cbec1..73f21bdd7cd 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsTypeNameOnUnions.snap @@ -649,6 +649,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var searchResults = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -665,6 +670,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Starship", global::System.StringComparison.Ordinal)) @@ -719,6 +729,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsUnionList.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsUnionList.snap index 6da7f1b6433..d85d3539c4f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsUnionList.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.StarWarsUnionList.snap @@ -646,6 +646,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var searchResults = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -662,6 +667,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Starship", global::System.StringComparison.Ordinal)) @@ -716,6 +726,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Subscription_With_Default_Names.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Subscription_With_Default_Names.snap index 960d5c5bdb7..71cafcc8506 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Subscription_With_Default_Names.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/StarWarsGeneratorTests.Subscription_With_Default_Names.snap @@ -405,6 +405,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + var typename = obj.Value.GetProperty("__typename").GetString(); if (typename?.Equals("Review", global::System.StringComparison.Ordinal) ?? false) { @@ -421,6 +426,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _intParser.Parse(obj.Value.GetInt32()!); } @@ -431,6 +441,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/__snapshots__/RazorGeneratorTests.Query_And_Mutation.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/__snapshots__/RazorGeneratorTests.Query_And_Mutation.snap index 16af4f89e2a..9e5d6770a28 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/__snapshots__/RazorGeneratorTests.Query_And_Mutation.snap +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/__snapshots__/RazorGeneratorTests.Query_And_Mutation.snap @@ -867,6 +867,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + var bars = new global::System.Collections.Generic.List(); foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) { @@ -883,6 +888,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Bar", global::System.StringComparison.Ordinal)) @@ -909,6 +919,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -919,6 +934,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } } @@ -960,6 +980,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value); entityIds.Add(entityId); if (entityId.Name.Equals("Bar", global::System.StringComparison.Ordinal)) @@ -986,6 +1011,11 @@ namespace Foo.Bar.State throw new global::System.ArgumentNullException(); } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + throw new global::System.ArgumentNullException(); + } + return _stringParser.Parse(obj.Value.GetString()!); } @@ -996,6 +1026,11 @@ namespace Foo.Bar.State return null; } + if (obj.Value.ValueKind == System.Text.Json.JsonValueKind.Null) + { + return null; + } + return _stringParser.Parse(obj.Value.GetString()!); } }