graphql-cli-load
graphql-cli-load copied to clipboard
Gave it a (unsuccessful) try
macOS Sierra
Node 9.
i ran graphql init and to get .graphqlconfig:
$ graphql init
? Local schema file path: schema.graphql
? Endpoint URL (Enter to skip): https://api.graph.cool/relay
/v1/cj9o4se940gsu0148s5a4helr
? Name of this endpoint, for e.g. default, dev, prod: server
? Subscription URL (Enter to skip):
? Do you want to add other endpoints? No
? What format do you want to save your config in? JSON
About to write to /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/.graphqlconfig:
{
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"server": "https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"
}
}
}
? Is this ok? Yes```
then ran graphql get-schema, which saw no changes with the previously existing schema.graphql file which seemed correct.
$ graphql get-schema Downloading introspection from https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr No changes
I then ran graphql load which failed with this json file [https://gist.github.com/idkjs/06d10b7a02edb8e6a2b10cb4608bdaa4] :
$ graphql load -m createCompany --json companies.json Using endpoint server: undefined Using mutation "createCompany": "". Done parsing JSON-file /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/companies.json rows: 90 Sending query: mutation {
}...
Parameter "url" must be a string, not undefined
I changed the endpoint in graphconfig to this:
{ "schemaPath": "schema.graphql", "extensions": { "endpoints": { "server": {"url":"https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"} } } }
Which produced this error:
```sh
GraphQL Error (Code: 200): {"response":{"error":"Syntax error while parsing GraphQL query. Invalid input \"mutation { \\n\\n}\", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):\nmutation { \n^","status":200},"request":{"query":"mutation { \n\n}","variables":{}}}
This is my graphcool playground mutation def:
This is what the mutation looks like in DevTools if I do one manually
-mutation & variables
mutation CreateCompanyMutation(
$input: CreateCompanyInput!
) {
createCompany(input: $input) {
company {
id
description
logo
}
}
}
- variables
{
"input": {
"description": "testatt",
"logo": "https://d25e16a427ed3ce77d27-76b466cd72f6b3a6e7219a8a02851d8e.ssl.cf1.rackcdn.com/files/59382428ff3935425ca91516/size_5_1001pharmaciesjpg.jpg",
"clientMutationId": ""
}
}
Any ideas? Thank you.
Thanks a lot for the feedback, I think it's because of the input object.
Could you do me a favor and try with a simple mutation that just uses scalars.
I have to add support for input objects, which are more tricky to map to.
What does your JSON file look like?
https://gist.github.com/idkjs/06d10b7a02edb8e6a2b10cb4608bdaa4