Git Product home page Git Product logo

Comments (13)

jexp avatar jexp commented on June 8, 2024

Can you share more about your JSON format (an example) and your mutation?

from graphql-cli-load.

jharmon141 avatar jharmon141 commented on June 8, 2024

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.

jexp avatar jexp commented on June 8, 2024

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.

jharmon141 avatar jharmon141 commented on June 8, 2024

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.

jexp avatar jexp commented on June 8, 2024

Ok thanks I'll investigate.
All the other graphql cli operations and plugins work without issues?

from graphql-cli-load.

jexp avatar jexp commented on June 8, 2024

Ok, I did two fixes, can you update from npm and try again.

  1. also handle endpoints that are stored as string
  2. 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.

jharmon141 avatar jharmon141 commented on June 8, 2024

I updated, but I'm still getting the same error.

from graphql-cli-load.

jexp avatar jexp commented on June 8, 2024

can you share your .graphqlconfig?
Fee free to redact the URL I just need the structure.

from graphql-cli-load.

jexp avatar jexp commented on June 8, 2024

How di you update ?

from graphql-cli-load.

NicolasSmit avatar NicolasSmit commented on June 8, 2024

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.

NicolasSmit avatar NicolasSmit commented on June 8, 2024

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.

jexp avatar jexp commented on June 8, 2024

Can't see a 4.2.0 release here: https://github.com/graphql-cli/graphql-cli/releases ?

from graphql-cli-load.

NicolasSmit avatar NicolasSmit commented on June 8, 2024

Sorry, I meant the last version

from graphql-cli-load.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.