react-relay icon indicating copy to clipboard operation
react-relay copied to clipboard

1-getting-started schema error with graphcool init

Open GordanRatkovic opened this issue 7 years ago • 3 comments

(Using graphcool 0.4) After running: graphcool init --schema https://graphqlbin.com/hn-relay.graphql --name Hackernews I run into this error: The relation field links has the wrong format: [Link!] Possible Formats: Link, Link!, [Link!]!

I created a local copy of hn-relay.graphql and replaced [Link!] with [Link!]! as well as [Vote!] with [Vote!]!. It solved the issue.

GordanRatkovic avatar Dec 20 '17 18:12 GordanRatkovic

I bet everything is not up to date.

JonathanSum avatar Feb 07 '18 02:02 JonathanSum

I'm getting the same thing as well. Any suggestions?

maryjenel avatar Jun 07 '18 20:06 maryjenel

@GordanRatkovic - I've noticed there are lots of changes in the last revision of graphcool which needs different acts to be done in order for the tutorial to work as expected:

  1. runing graphcool deploy will create an .graphcool.rc which (later) will contain the project cluster id in order to deploy the app in a docker.

  2. In the types.graphql root file, change the schema to the following (note: the File & User type is important since its a system type):

type File @model {
  contentType: String!
  createdAt: DateTime!
  id: ID! @isUnique
  name: String!
  secret: String! @isUnique
  size: Int!
  updatedAt: DateTime!
  url: String! @isUnique
}

type User @model {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!
  name: String!
  links: [Link!]! @relation(name: "UsersLinks")
  votes: [Vote!]! @relation(name: "UsersVotes")
}

type Link @model {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!
  url: String!
  description: String!
  postedBy: User @relation(name: "UsersLinks")
  votes: [Vote!]! @relation(name: "VotesOnLink")
}

type Vote @model {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!
  user: User @relation(name: "UsersVotes")
  link: Link @relation(name: "VotesOnLink")
}
  1. run graphcool login to login (opens your browser for authentication)
  2. run graphcool playground

Hope it help

levitomer avatar Jan 27 '20 15:01 levitomer