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

Fix InputFieldsAndArgumentsOfCorrectLength validation rule #3307

Merged
merged 1 commit into from Aug 26, 2022

Conversation

Shane32
Copy link
Member

@Shane32 Shane32 commented Aug 25, 2022

See #3301

@Shane32 Shane32 requested a review from sungam3r August 25, 2022 21:06
@Shane32 Shane32 self-assigned this Aug 25, 2022
@github-actions github-actions bot added the test Pull request that adds new or changes existing tests label Aug 25, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #3307 (5652d6d) into master (0a806c7) will increase coverage by 0.03%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #3307      +/-   ##
==========================================
+ Coverage   84.00%   84.04%   +0.03%     
==========================================
  Files         376      376              
  Lines       16178    16179       +1     
  Branches     2600     2600              
==========================================
+ Hits        13590    13597       +7     
+ Misses       1971     1964       -7     
- Partials      617      618       +1     
Impacted Files Coverage Δ
...s.Custom/InputFieldsAndArgumentsOfCorrectLength.cs 82.45% <0.00%> (-1.76%) ⬇️
...GraphQL/ResolveFieldContext/ResolveFieldContext.cs 96.77% <0.00%> (+1.69%) ⬆️
src/GraphQL/Builders/FieldBuilder.cs 81.75% <0.00%> (+2.70%) ⬆️
...raphQL/Utilities/Visitors/BaseSchemaNodeVisitor.cs 66.66% <0.00%> (+6.66%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -59,7 +59,7 @@ public override ValueTask VisitFieldAsync(ValidationContext context, GraphQLVari
new MatchingNodeVisitor<GraphQLArgument>((arg, context) => CheckLength(arg, arg.Value, context.TypeInfo.GetArgument(), context)),
new MatchingNodeVisitor<GraphQLObjectField>((field, context) =>
{
if (context.TypeInfo.GetInputType(1) is IInputObjectGraphType input)
if (context.TypeInfo.GetInputType(1)?.GetNamedType() is IInputObjectGraphType input)
Copy link
Member

Choose a reason for hiding this comment

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

🤦‍♂️


namespace GraphQL.Tests.Validation;

public class InputFieldsAndArgumentsOfCorrectLengthRequiredTests : ValidationTestBase<InputFieldsAndArgumentsOfCorrectLength, ValidationSchema>
Copy link
Member

Choose a reason for hiding this comment

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

You don't want to put tests in InputFieldsAndArgumentsOfCorrectLengthTests.cs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way is fine with me. It just seemed easier at the time to copy the whole file. Go ahead and make any changes to the PR you wish.

Copy link
Member

Choose a reason for hiding this comment

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

It seemed to me we had tests and I really found a file with tests. The next question that I asked myself - how they differ? Only non-null type modifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right; the only difference is that it is testing fields with non-null modifiers. The tests are all the same, I think.

Copy link
Member

Choose a reason for hiding this comment

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

ok

@sungam3r sungam3r added bugfix Pull request that fixes a bug directives Relates to GraphQL directives and removed directives Relates to GraphQL directives labels Aug 26, 2022
@Shane32 Shane32 merged commit 19d0fa1 into master Aug 26, 2022
@Shane32 Shane32 deleted the fix_input_fields_correct_length branch August 26, 2022 14:52
Kent-Chen-Conning added a commit to Conning/graphql-dotnet that referenced this pull request Oct 28, 2022
…TRAC-6694-upgrade-graphql-dotnet-server-to-7.1

* commit '13da37d7c0649cc6186714a6671272af49f06d85': (1255 commits)
  Add type integrity check when existing types are found (graphql-dotnet#3332)
  Switch to Nullability.Source (graphql-dotnet#3314)
  Add missing authorization extensions from field and connection builders (graphql-dotnet#3324)
  Prevent using graphtype as model (graphql-dotnet#3316)
  Remove init-only properties from pre-.NET 5 targets (graphql-dotnet#3323)
  Update UnionGraphType to support CLR references (graphql-dotnet#3320)
  Bump BenchmarkDotNet from 0.13.1 to 0.13.2 (graphql-dotnet#3313)
  Bump Microsoft.NET.Test.Sdk from 17.3.0 to 17.3.1 (graphql-dotnet#3311)
  Fix InputFieldsAndArgumentsOfCorrectLength validation rule (graphql-dotnet#3307)
  Bump Shouldly from 4.0.3 to 4.1.0 (graphql-dotnet#3304)
  Add test (graphql-dotnet#3302)
  !(a is T) -> a is not T (graphql-dotnet#3300)
  User not duplicated in context (graphql-dotnet#3298)
  Bump deps (graphql-dotnet#3295)
  Restore `Field<TGraphType>()` method (graphql-dotnet#3294)
  Include v7 migration document link in readme (graphql-dotnet#3290)
  Bump GraphQL-Parser to 8.1.0 (graphql-dotnet#3289)
  Migration notes updates (graphql-dotnet#3287)
  Simplify configuration (graphql-dotnet#3286)
  Introduce ErrorInfoProviderOptions.ExposeExceptionDetailsMode (graphql-dotnet#3276)
  ...

# Conflicts:
#	docs/package.json
#	src/GraphQL/GraphQL.csproj
#	src/GraphQL/Types/GraphTypesLookup.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Pull request that fixes a bug test Pull request that adds new or changes existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants