Skip to content

Query __args that are Integer value are not converting into integer #8

@BhupenT

Description

@BhupenT

Scenarios: lets say we got query like this:

{
users (first: 1000, where: {showInFrontend: true}) { // first : 1000 is an integer value
edges {
node {
databaseId
}
}
}
}

the resulting argument object becomes:
args { first: '1000', where: { showInFrontend: true } } // this is incorrect as its meant to be IntValue

I did a modification to your code locally for now to fix it. The Fix:
In your getArguments and getArgumentObject function you also want to check the kind for IntValue like this eg in your getArguments function :
} else if (arg.value.kind === 'IntValue') { argsObj[arg.name.value] = parseInt(arg.value.value); {

I can do a PR if you want. Also thanks saved me hours of work trying to convert to Json 👍

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions