Skip to content

Commit

Permalink
Fixed issue where generic types would invalidly be registered. (#5119)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Jun 3, 2022
1 parent 0feb645 commit 15ca0db
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public static Task<HttpResponseMessage> SendPostRequestAsync<TObject>(
public static Task<HttpResponseMessage> SendPostRequestAsync(
this TestServer testServer,
string requestBody,
string path = null,
string? path = null,
bool enableApolloTracing = false,
bool includeQueryPlan = false) =>
SendPostRequestAsync(
Expand All @@ -289,7 +289,7 @@ public static Task<HttpResponseMessage> SendPostRequestAsync(
this TestServer testServer,
string requestBody,
string contentType,
string path,
string? path,
bool enableApolloTracing = false,
bool includeQueryPlan = false)
{
Expand All @@ -314,11 +314,11 @@ public static Task<HttpResponseMessage> SendGetRequestAsync(
string path = null) =>
testServer.CreateClient().GetAsync($"{CreateUrl(path)}/?{query}");

public static string CreateUrl(string path)
public static string CreateUrl(string? path)
{
var url = "http://localhost:5000";

if (path != null)
if (path is not null)
{
url += "/" + path.TrimStart('/');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public bool TryHandle(
GeneratorSyntaxContext context,
[NotNullWhen(true)] out ISyntaxInfo? syntaxInfo)
{
if (context.Node is ClassDeclarationSyntax { BaseList.Types.Count: > 0 } possibleType)
if (context.Node is ClassDeclarationSyntax
{
BaseList.Types.Count: > 0,
TypeParameterList: null
} possibleType)
{
var model = context.SemanticModel.GetDeclaredSymbol(possibleType);
if (model is { IsAbstract: false } type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor
.Name("Query");

descriptor
.Field("person")
.Type("Entity")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace HotChocolate.Types;

public class SpecialObjectType<T> : ObjectType<T>
{

}

0 comments on commit 15ca0db

Please sign in to comment.