INNER CODE UNIT · JavaScript

getGraphRoot

sheerun/graphqlviz · index.js:215

function getGraphRoot (root) {
  // If there is only one of queryType, mutationType, or subscriptionType, use
  // that as the root. Otherwise root as the schema and treat
  // query/mutation/subscription as fields of that.
  var rootTypes = ['query', 'mutation', 'subscription']
    .map(name => {
      return {
        name: name,
        type: root[name + 'Type']
      }
    })
    .filter(t => {
      return t.type
    })

  if (rootTypes.length === 1) {
    return {
      q: [rootTypes[0].type.name],

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…