question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `null` parameters.

See original GitHub issue

Used 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:closed
  • Created a year ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Husqvikcommented, Oct 18, 2022

Thanks. Very valid point. I’ll hope to fix it during this week.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found