Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "path" argument must be of type string #8

Open
jharmon141 opened this issue Jan 28, 2018 · 13 comments
Open

The "path" argument must be of type string #8

jharmon141 opened this issue Jan 28, 2018 · 13 comments

Comments

@jharmon141
Copy link

Hi,

When I run graphql load -m createShipRate --json rates.json

I get:


The "path" argument must be of type string

@jexp
Copy link
Contributor

jexp commented Jan 28, 2018

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

@jharmon141
Copy link
Author

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
}

@jexp
Copy link
Contributor

jexp commented Jan 28, 2018

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.

@jharmon141
Copy link
Author

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.

@jexp
Copy link
Contributor

jexp commented Jan 28, 2018

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

@jexp
Copy link
Contributor

jexp commented Jan 29, 2018

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"}}...

@jharmon141
Copy link
Author

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

@jexp
Copy link
Contributor

jexp commented Jan 31, 2018

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

@jexp
Copy link
Contributor

jexp commented Jan 31, 2018

How di you update ?

@NicolasSmit
Copy link

NicolasSmit commented Feb 8, 2018

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 ?

@NicolasSmit
Copy link

After investigating a bit, I think this is because I was using graphql-cli@4.2.0 and your package depends on ^1.0.0-beta.4 version.
Currently trying it

@jexp
Copy link
Contributor

jexp commented Feb 8, 2018

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

@NicolasSmit
Copy link

Sorry, I meant the last version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants