Skip to content

Nullability for int for the source generated graphql variables is not respected #157

Description

@Jacob-Steentoft

Describe the bug

Whenever nullable integers are used for variables, the source generator sets the variable as required, not optional.

How to Reproduce

Use a nullable integer as a variable to a query.

Expected behavior

For integers to be nullable when the query is generated

The GraphqQL schema that fails

trips(
    "Returns the elements in the list that come after the specified cursor."
    after: String
    "Returns the elements in the list that come before the specified cursor."
    before: String
    "Returns the first _n_ elements from the list."
    first: Int
    "Returns the last _n_ elements from the list."
    last: Int
    order: [TripSortInput!] @cost(weight: "10")
    where: TripFilterInput @cost(weight: "10")
  ): TripConnection! @cost(weight: "10")

Screenshots

Image Image

Environment (please complete the following information):

  • Nuget package version 8.0.0
  • IDE: Rider
  • .Net Version 10.0.300

Additional context
Both anonymous and concrete types produces the same required integers

Here's the actual data sent over the wire:

{"variables":{"where":{"period":{"from":{"gte":"2026-01-01T00:00:00+00:00"},"to":{"lte":"2026-01-31T23:59:59.999999+00:00"}},"resourceId":{"eq":"029cb93b-18f9-ef11-bae2-002248a3413f"}},"pageSize":23,"cursor":"ezB8MXw2N30yMDI2MDEyMTA4NTYxNzAwMDAwMDAjMQ=="},"query":"query TripLogByResource($where: TripFilterInput!, $pageSize: Int!, $cursor: String) { trips(where: $where, first: $pageSize, after: $cursor) { nodes { id mileage driver { properties { displayName }  }  emissionsCo2InGrams destinationAddress { road houseNumber village postcode }  originAddress { road houseNumber village postcode }  lengthInMeters comment period { from to }  }  pageInfo { forwardCursors { cursor page }  backwardCursors { cursor page }  }  totalCount aggregatesPerResource { value { totalEmissionsCo2InGrams }  }  } }"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions