Skip to content

Rest to graphql doesn't honor the variables datatype of graphql schema #612

@codifierr

Description

@codifierr

Describe the bug
I was trying krakend Rest API call to Graphql and passing query params like below.
http://localhost:8085/test?foo=test&offset=1&limit=10
here test param is of string type but the offset and the limit are of integer type.
In my Graphql Schema, I have mentioned offset as int and limit as int.
But Krakend always sends all the param as strings to the graphql request variable and sends the request upstream. Which fails as the data is incorrect.

To Reproduce
Steps to reproduce the behavior:

  1. Send integer param in the query param and see the result in the graphql request. it sends them as string.
  2. Send params in the body and see the result in the graphql request. it sends them as string.

Expected behavior
Ideally while mapping query or path param to the variable of graphql query it should convert or keep the datatype mentioned as the graphql schema. An option to provide the datatype of query param in config can also work.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions