sarkistlt / graphql-auto-generating-cms

Use your existing graphQL schema to generate CMS in a couple steps. DEMO: http://cms-demo.web4fly.com/
380 stars 36 forks source link

Use "Viewer" instead of "Query" #17

Open jamsea opened 6 years ago

jamsea commented 6 years ago

Hi,

Great project, just poking around the code trying to glue it to the graphql schema I already have. I noticed you're pulling the Queries from this line of code: https://github.com/sarkistlt/graphql-auto-generating-cms/blob/9d9afdbfb5e2603c32192e453d0d98a4f01dfe59/src/middleware.js#L100

I have Viewer and Root in my schema instead (because of Relay), with Root containing the queries. For example my queries take this shape:

query exampleQuery {
  viewer {
    Organization {
      customer(firstName: "Steve") {
        firstName,
        lastName
      }
    }
  }
}

Any idea how I'd tell graphql-auto-generating-cms to resolve the correct query?

sarkistlt commented 6 years ago

thanks. Right now it's not possible, only if you will rewrite schema parser middlewhere to add Relay support. I don't use Relay, don't even have any projects that uses it to play around and see what could be done. I thing we need separate schema parser for Relay, and we can make as an option when you configure your middlewhere.