title: Convert GraphQL shorthand notation to respective object?
body: <p>I am working on a GraphQL server setup where it can parse Types passed into it from strings, and I am looking for a solution to convert a string to an appropriate object. For example, if the string here is passed in:</p>
  
  <pre><code>type User { id: String, name: String }
  </code></pre>
  
  <p>My function would return the equivelant of running this code:</p>
  
  <pre><code>new graphql.GraphQLObjectType({
    name: 'User',
    fields: {
      id: { type: graphql.GraphQLString },
      name: { type: graphql.GraphQLString },
    }
  });
  </code></pre>
  
  <p>The key here is to be agnostic, so I could also pass in say, interfaces, and other shorthand and have it return the appropriate object. I have gotten as far as achieving the Abstract Syntax Tree from the <code>graphql/language</code> module bu using <code>graphql_language.parse(str)</code> function, but I'm unsure where to go from here.</p>