Skip to content

Commit

Permalink
Do not set resolvers for input and interface types (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored May 5, 2023
1 parent 0f9b620 commit 482b1d1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<Compile Remove="wwwroot\**" />
<Content Remove="wwwroot\**" />
Expand All @@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="GraphQL.DataLoader" Version="7.2.0" />
<PackageReference Include="GraphQL.DataLoader" Version="7.4.1" />
<PackageReference Include="GraphQL.Server.Ui.Playground" Version="7.1.1" />
<ProjectReference Include="../../../src/GraphQL.Conventions/GraphQL.Conventions.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.6" />
Expand Down
6 changes: 3 additions & 3 deletions samples/SimpleWebApp.Tests/SimpleWebApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Expand All @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -22,6 +22,6 @@
</ItemGroup>

<ItemGroup>
<Using Include="Xunit"/>
<Using Include="Xunit" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.SystemTextJson" Version="7.2.0" />
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.2.0" />
<PackageReference Include="GraphQL.SystemTextJson" Version="7.4.1" />
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.4.1" />
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="7.1.1" />
<PackageReference Include="GraphQL.Server.Ui.Playground" Version="7.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.16.1" />
Expand Down
8 changes: 5 additions & 3 deletions src/GraphQL.Conventions/Adapters/GraphTypeAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ private IObjectGraphType DeriveOperationType(GraphTypeInfo typeInfo) =>

private FieldType DeriveField(GraphFieldInfo fieldInfo)
{
bool resolvable = fieldInfo.DeclaringType.IsOutputType && !fieldInfo.DeclaringType.IsInterfaceType;

if (fieldInfo.Type.IsObservable)
{
var resolver = FieldResolverFactory(fieldInfo);
var streamResolver = new EventStreamResolver(resolver);
var resolver = resolvable ? FieldResolverFactory(fieldInfo) : null;
var streamResolver = resolvable ? new EventStreamResolver(resolver) : null;
return new FieldType
{
Name = fieldInfo.Name,
Expand All @@ -110,7 +112,7 @@ private FieldType DeriveField(GraphFieldInfo fieldInfo)
DefaultValue = fieldInfo.DefaultValue,
Type = GetType(fieldInfo.Type),
Arguments = new QueryArguments(fieldInfo.Arguments.Where(arg => !arg.IsInjected).Select(DeriveArgument)),
Resolver = FieldResolverFactory(fieldInfo),
Resolver = resolvable ? FieldResolverFactory(fieldInfo) : null,
};
}

Expand Down
6 changes: 3 additions & 3 deletions src/GraphQL.Conventions/GraphQL.Conventions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>GraphQL Conventions for .NET</Description>
<VersionPrefix>7.2.0-preview</VersionPrefix>
<VersionPrefix>7.2.1-preview</VersionPrefix>
<Authors>Tommy Lillehagen</Authors>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
Expand All @@ -27,8 +27,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.DataLoader" Version="7.2.0" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.2.0" />
<PackageReference Include="GraphQL.DataLoader" Version="7.4.1" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.4.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.DataLoader" Version="7.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.2.0" />
<PackageReference Include="GraphQL.DataLoader" Version="7.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 482b1d1

Please sign in to comment.