graphman icon indicating copy to clipboard operation
graphman copied to clipboard

feat: support other GraphQL clients by outputing to plain folders and .graphql files

Open jmfayard opened this issue 2 years ago • 2 comments

Bonjour,

I heard from graphman at https://dev.to/tristankalos/graphman-generate-a-postman-collection-for-any-graphql-endpoint-4hff

Your tool seems like something that is totally needed.

GrapphQL being a standard, I feel like it should nothing in it is specific to Postman no ?

Apart from the very last step where you store the queries in the Postman collection format.

I use https://insomnia.rest/ and the GraphQL plugin for IntelliJ

If you have an option to write the queries simply in a plain folder with plain some-query.graphql files, I would totally use it.

jmfayard avatar Aug 10 '22 04:08 jmfayard

That's a great idea, and it should be easy to do with the existing codebase! Adding it to my to-do list, thanks for the suggestion! PS: The exported postman collection is already compatible with insomnia :)

nohehf avatar Aug 10 '22 07:08 nohehf

Actually there is also the standard that works in many clients to put informations like the URL, headers, introspection, ... in a file called .graphqlconfig

Example .graphqlconfig file for GitHub GraphQL:

{
  "name": "GitHub GraphQL API",
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "https://api.github.com/graphql": {
        "url": "https://api.github.com/graphql",
        "headers": {
          "user-agent": "JS GraphQL",
          "Authorization": "bearer ${env:GITHUB_TOKEN}"
        },
        "introspect": true
      }
    }
  }
}

So with this we would have all the other informations from the Postman collection

jmfayard avatar Aug 10 '22 08:08 jmfayard