Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4453325

Browse filesBrowse files
Fixed a bug with early out ignoring of input fields (#150)
1 parent 3c88cfd commit 4453325
Copy full SHA for 4453325

File tree

3 files changed

+68
-1
lines changed
Filter options

3 files changed

+68
-1
lines changed

‎src/graphql-aspnet/Internal/TypeTemplates/InputObjectGraphTypeTemplate.cs

Copy file name to clipboardExpand all lines: src/graphql-aspnet/Internal/TypeTemplates/InputObjectGraphTypeTemplate.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private bool CanBeInputField(PropertyInfo propInfo)
155155
if (propInfo == null)
156156
return false;
157157

158-
if (propInfo.Attributes.SingleAttributeOrDefault<GraphSkipAttribute>() != null)
158+
if (propInfo.HasAttribute<GraphSkipAttribute>())
159159
return false;
160160

161161
if (Constants.IgnoredFieldNames.Contains(propInfo.Name))
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// *************************************************************
2+
// project: graphql-aspnet
3+
// --
4+
// repo: https://github.com/graphql-aspnet
5+
// docs: https://graphql-aspnet.github.io
6+
// --
7+
// License: MIT
8+
// *************************************************************
9+
10+
namespace GraphQL.AspNet.Tests.Execution
11+
{
12+
using GraphQL.AspNet.Tests.Execution.TestData.GraphSkipSequencingTestData;
13+
using GraphQL.AspNet.Tests.Framework;
14+
using NUnit.Framework;
15+
16+
[TestFixture]
17+
public class GraphSkipSequencingTests
18+
{
19+
[Test]
20+
public void SkipFieldWithSameNameAsAnotherField_OBJECT()
21+
{
22+
using var restore = new GraphQLGlobalRestorePoint(true);
23+
24+
var server = new TestServerBuilder()
25+
.AddGraphQL(o =>
26+
{
27+
o.AddType<ClassWithRenamedField>(AspNet.Schemas.TypeSystem.TypeKind.OBJECT);
28+
})
29+
.Build();
30+
}
31+
32+
[Test]
33+
public void SkipFieldWithSameNameAsAnotherField_INPUTOBJECT()
34+
{
35+
using var restore = new GraphQLGlobalRestorePoint(true);
36+
37+
var server = new TestServerBuilder()
38+
.AddGraphQL(o =>
39+
{
40+
o.AddType<ClassWithRenamedField>(AspNet.Schemas.TypeSystem.TypeKind.INPUT_OBJECT);
41+
})
42+
.Build();
43+
}
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// *************************************************************
2+
// project: graphql-aspnet
3+
// --
4+
// repo: https://github.com/graphql-aspnet
5+
// docs: https://graphql-aspnet.github.io
6+
// --
7+
// License: MIT
8+
// *************************************************************
9+
10+
namespace GraphQL.AspNet.Tests.Execution.TestData.GraphSkipSequencingTestData
11+
{
12+
using GraphQL.AspNet.Attributes;
13+
14+
public class ClassWithRenamedField
15+
{
16+
[GraphSkip]
17+
public int RootNamedField { get; set; }
18+
19+
[GraphField("RootNamedField")]
20+
public string ReNamedField { get; set; }
21+
}
22+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.