Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for arg array typing #4352

Merged
merged 3 commits into from
Oct 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/HotChocolate/Core/test/Types.Tests/Types/ArgumentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ public async Task InvokeAsync(IMiddlewareContext context)
{
throw new Exception();
benmccallum marked this conversation as resolved.
Show resolved Hide resolved
}

if (context.Selection.Field.Name.Value.StartsWith("array"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In v11, arrays are treated as lists, but the arg def also says it's a list, so it was passing the check above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the runtime type is an array? Or what is the issue?

{
if (!argument.RuntimeType.IsArray)
{
context.ReportError($"Field defined with array but ArgDeg saying it's a {argument.RuntimeType}");
}

if (!actualType.IsArray)
{
context.ReportError($"Field defined with array but actual type is a {actualType}");
}
}
}

await _next(context);
Expand Down