Skip to content

Default values specified for Int field are passed in as BigInteger to Resolver #344

@rsnayak

Description

@rsnayak

I'm running into an issue with a list of default Int values in my schema. If I pass in a list of values as arguments in my query, they are passed in as Integers to my Resolver, however, if I don't specify any values in my query, the default values are sent in as BigIntegers resulting in cast exceptions. Here is an example:

Here is my Venue Type:

type Venue {
    venueId: ID!
    name: String!
    location: String!
    meetings(type: [Int] = [1,2,3,4,5,6,7,8,9,10]): [Meeting!]!
}

Meeting type

type Meeting {
  meetingId: ID!
  subject: String
  type: Int
}

MyQuery

{findVenues(hotelId: 512){
  venue{
    venueId,
    name,
    meetings(type:[1,2])   {
      meetingId,
      type
    }
  }
}}

if I specify type:[1,2], they are sent in Integers to the "getMeetings" method of my VenueResolver. If I don't send in any values as in:

{findVenues(hotelId: 512){
  venue{
    venueId,
    name,
    meetings  {
      meetingId,
      type
    }
  }
}}

The default type List is sent in as BigIntegers to my getMeetings method of my VenueResolver. I could work around this by accepting the arguments as a csv and then parsing the argument, but it seems counterintuitive to pass in a csv when the field is an Int. Can you please let me know what I'm doing wrong?

Thanks!
Raj

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions