graphql-cli icon indicating copy to clipboard operation
graphql-cli copied to clipboard

Cannot get-schema when No project defined

Open rwinzhang opened this issue 8 years ago • 7 comments

my .graphqlconfig file

{
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "production": {
        "url": "https://api.github.com/graphql",
        "headers": {
          "Authorization": "Bearer ${env:API_TOKEN}"
        }
      }
    }
  }
}

current workaround is running this command API_TOKEN=abc graphql get-schema --project github

expected behavior the following command should run API_TOKEN=abc graphql get-schema

rwinzhang avatar Jun 19 '18 15:06 rwinzhang

I ran into the same issue. The project can be specified like this:

{
  "projects": {
    "Project Name": {
      "schemaPath": "schema.graphql",
      "extensions": {
        "endpoints": {
          "dev":  {
            "url": "http://localhost:3000/graphql",
            "headers": {
              "Authorization": "Bearer ${env:AUTH_TOKEN_ENV}"
            }
          }
        }
      }
    }
  }
}

tanduong avatar Jun 30 '18 18:06 tanduong

same problem here. get-schema should also work, when no project is specified, in particular, because in graphql init it defaults to no project.

Also, if you add a project to your graphqlconfig, every other graphql command will ask you to select a project (which is only one). That is very inconvenient

macrozone avatar Jan 07 '19 21:01 macrozone

This is clearly a bug. all the commands should work even if no project is specified.

leethree avatar Jan 10 '19 13:01 leethree

graphql init
graphql get-schema -e dev

This commands works for me, note if you put -e dev, in the end, it will work

dev-rkoshlyak avatar Jul 19 '19 05:07 dev-rkoshlyak

Still the same, this is a bug and should be fixed. Does anybody know where the bug is in the code?

DanielRuf avatar Sep 10 '19 07:09 DanielRuf

We've just released a new version and an alpha release channel for GraphQL CLI - 4.0.0-alpha.XXX!

We've changed the get-schema command to use GraphQL Code Generator plugin of GraphQL CLI with the Codegen's schema-ast plugin.

We've also moved to use the new alpha version of graphql-config!

Could you check if that solves your current issue?

Checkout new instructions and the migration guide and we will be happy to hear your feedback during the alpha period!

Feel free to contact us by opening an issue or using our Discord channel; https://discord.gg/xud7bH

Urigo avatar Oct 29 '19 18:10 Urigo

I've posted the wrong Discord link, this is the correct one: https://discord.gg/xud7bH9

Urigo avatar Oct 29 '19 19:10 Urigo