Escape-Technologies / graphman

Quikly scaffold a postman collection for a GraphQL API. Compatible with Postman & Insomnia.
MIT License
242 stars 12 forks source link

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

Open jmfayard opened 2 years ago

jmfayard commented 2 years ago

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.

nohehf commented 2 years ago

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 :)

jmfayard commented 2 years ago

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