Comments (13)
Can you share more about your JSON format (an example) and your mutation?
from graphql-cli-load.
Sure, here is what my JSON looks like:
[
{
"countryCode": "BH",
"countryName": "BAHRAIN",
"maxLength": 150,
"maxLWH": 300,
"maxWeight": 300,
"method": "EMS",
"minWeight": 0,
"rate": 1200,
"regionCode": 21
},
{
"countryCode": "BH",
"countryName": "BAHRAIN",
"maxLength": 150,
"maxLWH": 300,
"maxWeight": 500,
"method": "EMS",
"minWeight": 300,
"rate": 1500,
"regionCode": 21
},
{
"countryCode": "BH",
"countryName": "BAHRAIN",
"maxLength": 150,
"maxLWH": 300,
"maxWeight": 600,
"method": "EMS",
"minWeight": 500,
"rate": 1680,
"regionCode": 21
}
]
The schema that came back when I ran graphql get-schema
looks like this:
input CreateShipRate {
countryCode: String!
countryName: String!
maxLength: Int!
maxLWH: Int!
maxWeight: Int!
method: String!
minWeight: Int!
rate: Int!
regionCode: Int!
}
And the mutations look like this:
type Mutation {
createShipRate(countryCode: String!, countryName: String!, maxLength: Int!, maxLWH: Int!, maxWeight: Int!, method: String!, minWeight: Int!, rate: Int!, regionCode: Int!): ShipRate
updateShipRate(countryCode: String, countryName: String, id: ID!, maxLength: Int, maxLWH: Int, maxWeight: Int, method: String, minWeight: Int, rate: Int, regionCode: Int): ShipRate
updateOrCreateShipRate(update: UpdateShipRate!, create: CreateShipRate!): ShipRate
deleteShipRate(id: ID!): ShipRate
}
from graphql-cli-load.
This looks good to me.
What graphql-api is your backend running?
The schema should be a bit more complete, it misses ShipRate, and the query types.
from graphql-cli-load.
I'm using Graphcool.
The schema is more complete. It includes the query types and the ShipRate type. It was just a lot to include here and from what I can tell it looks correct.
from graphql-cli-load.
Ok thanks I'll investigate.
All the other graphql cli operations and plugins work without issues?
from graphql-cli-load.
Ok, I did two fixes, can you update from npm and try again.
- also handle endpoints that are stored as string
- handle object-type returns from mutations
load -m createShipRate --json rates.json
Using endpoint default: {"url":"https://api.graph.cool/simple/v1/cj2chjbncvq730104upuyxxx"}
Using mutation "createShipRate": "".
Done parsing JSON-file /Users/mh/trash/shiprate/rates.json rows: 3
Sending query:
mutation {
_0 : createShipRate ( countryCode: "BH",countryName: "BAHRAIN",maxLength: 150,maxLWH: 300,maxWeight: 300,method: "EMS",minWeight: 0,rate: 1200,regionCode: 21 ) { id }
_1 : createShipRate (...
✔ Call succeeded:
{"_0":{"id":"cjd0stgct574n0107e687zbci"},"_1":{"id":"cjd0stgd9574p0107yx8zhjhi"},"_2":{"id":"cjd0stgdn574r0107w2feufml"}}...
from graphql-cli-load.
I updated, but I'm still getting the same error.
from graphql-cli-load.
can you share your .graphqlconfig?
Fee free to redact the URL I just need the structure.
from graphql-cli-load.
How di you update ?
from graphql-cli-load.
Hi @jexp
I'm also facing this issue, I've tried with multiple configs, here is the last .graphqlconfig I used :
"projects": {
"Sports": {
"schemaPath": "./schema.graphql",
"extensions": {
"endpoints": {
"local": "http://localhost/graphql"
},
"load": {
"csv": "clubs.csv",
"mutation": "newUser",
"mapping": {"pseudo": "Pseudo", "password": "Password", "email": "Email", "profileType": "ProfileType", "sex": "Gender"}
}
}
}
}
}
Using graphql load -e local
or the full command still return 'Path must be a string. Received undefined'.
Do you have any update on this issue ?
from graphql-cli-load.
After investigating a bit, I think this is because I was using [email protected]
and your package depends on ^1.0.0-beta.4 version.
Currently trying it
from graphql-cli-load.
Can't see a 4.2.0 release here: https://github.com/graphql-cli/graphql-cli/releases ?
from graphql-cli-load.
Sorry, I meant the last version
from graphql-cli-load.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-cli-load.