-
Notifications
You must be signed in to change notification settings - Fork 50
Conversation
Thanks a lot for this, it looks great. Does just the right thing. Could you add a test case? There's a test I exported, or whatever test you had. You could put it in eg {
"info": {
"_postman_id": "505fff05-4b0c-4356-8964-ca8a1ae68999",
"name": "GraphQL",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Test Request",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query getCollectionDetails {\n collections {\n name\n }\n}",
"variables": "{\n\t\"name\": \"{{artist}}\"\n}"
}
},
"url": {
"raw": "http://example.com/graphql",
"protocol": "http",
"host": [
"example",
"com"
],
"path": [
"graphql"
]
}
},
"response": []
}
]
} |
What do you think about the GraphQL variables? Are you using them? They need some additional logic but if you're not using them maybe they could be left out of the first version. |
@bookmoons GraphQL variables make life so much easier. I use them heavily so for the first version it'd probably be ideal. Just to note, Postman exports variables in a simple JSON object and the test added to the repository reflects that the I'm not sure the implications of GraphQL variables linked with Postman environment variables. Any additional guidance would be appreciated! 馃憤 |
Alright, I think this is what it looks like:
There's a standard Postman var replacement that happens on the string body. Probably it needs to be determined whether that still happens for graphql and in what order with graphql vars, so it can be either disabled or correctly ordered when doing a graphql request. |
@bookmoons Just getting back to this. I found out my implementation will work for our purposes without the variables. Went ahead and got this PR to cleanly merge with the last few weeks of changes. Let me know if it's good to go or should await the full implementation. |
Thanks @dmhalejr! Will look this over soon. |
Tested this against the GitHub API and it worked just fine. It also happens to run the query through Postman var replacement, so that's a usable alternative to GraphQL vars. Thanks a lot @dmhalejr. @robingustafsson After the little update above this change has my approval. |
Thanks for updating that @dmhalejr. |
Great, thanks @dmhalejr for contribution and @bookmoons for review. Sorry for delay, I'm merging this. |
Closes #36
Following this blog post, I've switched all my API testing collections to graphql body mode.
https://blog.getpostman.com/2019/06/18/postman-v7-2-supports-graphql/
There's probably more nuance in the solution but wanted to get something going as a starting point. Ran all tests locally and they still continued to pass and ran
bin/postman-to-k6.js
locally gave me appropriate output.Let me know if there's anything else I can assist with! Thanks for all you do! 馃檱