Urigo / graphql-cli

📟 Command line tool for common GraphQL development workflows
https://graphql-cli.com
MIT License
1.99k stars 113 forks source link

Cannot get-schema when No project defined #327

Closed rwinzhang closed 4 years ago

rwinzhang commented 6 years ago

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

tanduong commented 6 years ago

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}"
            }
          }
        }
      }
    }
  }
}
macrozone commented 5 years ago

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

leethree commented 5 years ago

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

dev-rkoshlyak commented 5 years ago
graphql init
graphql get-schema -e dev

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

DanielRuf commented 4 years ago

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

Urigo commented 4 years ago

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 commented 4 years ago

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