Support `null` parameters.
See original GitHub issueUsed NuGet Packages:
GraphQlClientGenerator version 0.9.12 GraphQl.Client version 5.1.0
Used Language: net6.0
for query-parameters I would like to suggest to implement a possibility to add parameters without values so for example :
var homeIdParameter = new GraphQlQueryParameter<Guid>("homeId", "ID", null);
var builder =
new TibberQueryBuilder()
.WithViewer(
new ViewerQueryBuilder()
.WithHome(new HomeQueryBuilder().WithAllScalarFields(), homeIdParameter)
)
.WithParameter(homeIdParameter);
var variables = new {
homeId = "SOME GUID",
};
So we can use it with GraphQlHttpClient
which support Variables as seen here.
Because in my case I have queries that have nullable parameters but when I fill in null
I get a GraphQL error that says :
{
"errors": [
{
"message": "Syntax Error GraphQL (2:28) Unexpected Name \"null\"\n\n1: query (\n2: $parameterName: UUID = null,\n",
"locations": [
{
"line": 2,
"column": 28
}
]
}
]
}
query looks like :
query ($homeId: ID = null) {
viewer{
home(id: $homeId) {
id
timeZone
appNickname
appAvatar
size
type
numberOfResidents
primaryHeatingSource
hasVentilationSystem
mainFuseSize
}
}
}
I would like the builded query to look like(notice there is no parameter value) :
query ($homeId: UUID) {
viewer{
home(id: $homeId) {
id
timeZone
appNickname
appAvatar
size
type
numberOfResidents
primaryHeatingSource
hasVentilationSystem
mainFuseSize
}
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Amazon QuickSight supports NULL in parameter - AWS
Amazon QuickSight now fully support NULL in parameter use. Parameter, as a place holder for single value or multi-value variables, ...
Read more >Spring Data JPA and Null Parameters
Learn different ways to use null parameters with Spring Data JPA queries, including how to make query parameters optional.
Read more >Stored procedure doesn't allow null parameters even the ...
I just found that I can set default values for the parameter in the stored procedure: ALTER proc [dbo].
Read more >Amazon QuickSight supports NULL in parameter
Amazon QuickSight now fully support NULL in parameter use. Parameter, as a place holder for single value or multi-value variables, ...
Read more >How do I make my parameter work when it is a null value?
When the parameter has no value, SQL interprets it as null in your code. Null means no value. You can fix this problem...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://www.nuget.org/packages/GraphQlClientGenerator.Tool/0.9.13
Thanks. Very valid point. I’ll hope to fix it during this week.