Skip to content

Commit f3fb80c

Browse files
authored
Bump to GraphQL.NET v8 (#23)
1 parent 6f3add4 commit f3fb80c

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<IsPackable>false</IsPackable>
2323
<PackageReadmeFile>README.md</PackageReadmeFile>
2424
<AnalysisMode>Recommended</AnalysisMode>
25-
<GraphQLVersion>7.0.0</GraphQLVersion>
26-
<GraphQLAspNetCore3Version>5.0.0</GraphQLAspNetCore3Version>
25+
<GraphQLVersion>8.0.0</GraphQLVersion>
26+
<GraphQLAspNetCore3Version>6.0.0</GraphQLAspNetCore3Version>
2727
</PropertyGroup>
2828

2929
<ItemGroup>

Sample/Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageReference Include="EfLocalDb" Version="8.5.0" />
1010
<PackageReference Include="GraphQL.DataLoader" Version="$(GraphQLVersion)" />
1111
<PackageReference Include="GraphQL.AspNetCore3" Version="$(GraphQLAspNetCore3Version)" />
12-
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="$(GraphQLVersion)" />
12+
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="7.7.2" />
1313
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.16" />
1414
</ItemGroup>
1515

src/GraphQL.DI/DIObjectGraphBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public abstract class DIObjectGraphBase<TSource> : IDIObjectGraphBase<TSource>,
5454
Dictionary<string, (GraphQLField Field, FieldType FieldType)>? IResolveFieldContext.SubFields => Context.SubFields;
5555
IReadOnlyDictionary<string, object?> IResolveFieldContext.InputExtensions => Context.InputExtensions;
5656
IDictionary<string, object?> IResolveFieldContext.OutputExtensions => Context.OutputExtensions;
57+
IExecutionContext IResolveFieldContext.ExecutionContext => Context.ExecutionContext;
5758
}
5859

5960
/// <summary>

src/Tests/DIObjectGraphBaseTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void SourceTyped()
6666
[Fact]
6767
public void RFC_FieldAst()
6868
{
69-
var fieldAst = new GraphQLField();
69+
var fieldAst = new GraphQLField(new("test"));
7070
_mockContext.Setup(x => x.FieldAst).Returns(fieldAst);
7171
_graphContext.FieldAst.ShouldBe(fieldAst);
7272
}
@@ -130,15 +130,15 @@ public void RFC_Schema()
130130
[Fact]
131131
public void RFC_Document()
132132
{
133-
var obj = new GraphQLDocument();
133+
var obj = new GraphQLDocument(new());
134134
_mockContext.Setup(x => x.Document).Returns(obj);
135135
_graphContext.Document.ShouldBe(obj);
136136
}
137137

138138
[Fact]
139139
public void RFC_Operation()
140140
{
141-
var obj = new GraphQLOperationDefinition();
141+
var obj = new GraphQLOperationDefinition(new(new()));
142142
_mockContext.Setup(x => x.Operation).Returns(obj);
143143
_graphContext.Operation.ShouldBe(obj);
144144
}

src/Tests/DIObjectGraphTypeTests/Argument.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.ComponentModel;
22
using System.Globalization;
3+
using GraphQL.Conversion;
34

45
namespace DIObjectGraphTypeTests;
56

@@ -128,10 +129,22 @@ public void IdNonNull()
128129
{
129130
Configure<CIdGraphType2, object>();
130131
VerifyFieldArgument("Field1", "arg", typeof(NonNullGraphType<IdGraphType>), "3");
131-
VerifyField("Field1", true, false, "3");
132+
InitializeSchema();
133+
VerifyField("Field1", typeof(StringGraphType), false, "3");
132134
Verify(false);
133135
}
134136

137+
private void InitializeSchema()
138+
{
139+
if (_graphType == null)
140+
throw new InvalidOperationException();
141+
var schema = new Schema { Query = new ObjectGraphType() { Name = "Query" } };
142+
schema.Query.AddField(new FieldType { Name = "dummy", Type = typeof(StringGraphType) });
143+
schema.RegisterType(_graphType);
144+
schema.NameConverter = DefaultNameConverter.Instance;
145+
schema.Initialize();
146+
}
147+
135148
public class CIdGraphType2 : DIObjectGraphBase
136149
{
137150
public static string? Field1([Id] int arg) => arg.ToString(CultureInfo.InvariantCulture);
@@ -160,7 +173,7 @@ public void DefaultValue()
160173
Configure<CDefaultValue, object>();
161174
VerifyFieldArgument("Field1", "arg1", false, 2);
162175
VerifyField("Field1", false, false, 2);
163-
VerifyFieldArgument<int>("Field2", "arg2", false);
176+
VerifyFieldArgument("Field2", "arg2", false, 5); // as of version 8, IResolveFieldContext.Arguments include the default values
164177
VerifyField("Field2", false, false, 5);
165178
Verify(false);
166179
}

0 commit comments

Comments
 (0)