Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
codifierr opened this issue Sep 20, 2022 · 2 comments
Open
Labels
new feature New feature request

Comments

@codifierr
Copy link

codifierr commented Sep 20, 2022

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.

@alombarte alombarte added the new feature New feature request label Sep 20, 2022
@alombarte
Copy link
Member

Hello @codifierr, thanks for spending the time to report this issue.

When working with URLs, query strings do not have type. Even that you can treat ?param=1 in your backend as an integer, a string, or even a boolean, these are just human assumptions, as the type is not implicit anywhere.

Considering that Lura does not know the schema at all, I am not classifying this issue as a bug (but a feature request)

@codifierr
Copy link
Author

Hi @alombarte,
Thanks for acknowledging this as a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants