-
-
Notifications
You must be signed in to change notification settings - Fork 787
Open
Labels
Area: Type SystemIssue is related to the Type SystemIssue is related to the Type SystemYouTube🌶️ hot chocolate
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Product
Hot Chocolate
Describe the bug
I have created a custom directive defaultCount
which take value
as argument
public class DefaultValue
{
public int? Value { get; set; }
}
public class DefaultDirectiveType : DirectiveType<DefaultValue>
{
public const string name = "defaultCount";
protected override void Configure(IDirectiveTypeDescriptor<DefaultValue> descriptor)
{
descriptor.Name(name);
descriptor.Location(DirectiveLocation.Field);
descriptor.Use((next, directive) => async (context) =>
{
await next.Invoke(context);
}
);
}
}
Now here are my cases of using it
-
✅ Pass the value directly while using the
descriptor.Use
methodquery { categories { nodes { id @defaultCount(value: 10) } } }
-
❌ Pass the value using
variable
while using thedescriptor.Use
methodquery Test($totalCount: Int) { categories { nodes { id @defaultCount(value: $totalCount) } } }
The result was
{ "errors": [ { "message": "Int cannot parse the given literal of type `VariableNode`.", "path": [ "value" ], "extensions": { "field": "defaultCount.value", "fieldType": "Int" } } ] }
-
✅ remove
descriptor.Use
method and pass the value usingvariable
// removed this method descriptor.Use(...);
query Test($totalCount: Int) { categories { nodes { id @defaultCount(value: $totalCount) } } }
Steps to reproduce
Relevant log output
No response
Additional Context?
No response
Version
13.0.5
dklesev, hognevevle, nikcio, RichGreen and Hanskrogh
Metadata
Metadata
Assignees
Labels
Area: Type SystemIssue is related to the Type SystemIssue is related to the Type SystemYouTube🌶️ hot chocolate