postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.85k stars 839 forks source link

GraphQL requests: Using UI set the wrong type to the variable (Long to String) #12756

Open allinsonmota opened 7 months ago

allinsonmota commented 7 months ago

Is there an existing issue for this?

Describe the Issue

Hello, I'm using the Postman version for MAC (details of the Postman version below) and it seems that when creating a GraphQL request from the UI, there might be an error. While assembling the request from the UI and filling in the input corresponding to an id defined as "Long" (which is defined as Long in the schema and appears to be recognized as such in the UI), it gets transformed into a String, causing an error when executing the query due to data type differences. I'm attaching a video showing the potential error.

Steps To Reproduce

  1. Create a new Graphql request
  2. Wait until the UI gets the schema and shows all the methods and fields.
  3. Search for and argument of type Long and filled from the interface. (while you typing the input you'll see it will convert to String automatically).
  4. execute the request.

Screenshots or Videos

The video:

https://github.com/postmanlabs/postman-app-support/assets/7458011/e59716d3-760a-440d-815d-240c362c4298

Operating System

macOS

Postman Version

10.24.11

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

ronork commented 7 months ago

Hey @allinsonmota , thank you for reporting the issue. I was able to reproduce the issue; currently, the GraphQL query editor treats all scalar types as strings, which impacts how your Long type is handled. While standard GraphQL types (Int, Float, Boolean, etc.) work as intended, we'll investigate this further to see how we can potentially improve custom scalar type handling.

mattjohnsonpint commented 6 months ago

Hi. I also have this issue. It does work if you edit the request to remove the quotation marks, but the UI will put them back if you use the separate field input box.

Is there any hint that we can give when defining a custom scalar? Perhaps a directive, such as @specifiedBy (though I'm not sure which RFC would apply for a Long). Or it could be a custom directive for postman, or it could just be by naming convention, etc.

Thanks.

mitchross commented 4 months ago

I am facing this issue as well.