- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.1k
 
Description
Hi,
First of all, I´d like to thank you for the awesome job you have done with the spec and this reference implementation. It took only couple of hours to build a GraphQL "proxy" server by generating GraphQL schema from a preexisting JSON schema definition we had for our REST API and I'm already experiencing the benefits.
The only question I have is this; We have some abstract field types in our api. For example some responses may contain user supplied JSON metadata. This means I'm unable to define the actual fields and types for the data. Currently I'm using an ugly way to handle these fields by creating a scalar type and using that for the metadata fields.
var GraphQLAnything = new GraphQLScalarType({
  name: 'Anything',
  coerce: function (value) {
    return value;
  },
  coerceLiteral: function (ast) {
    return ast.value;
  }
});This works as desired (I'm able to receive the data in correct form) but defining something like this as a scalar feels wrong in so many levels. Especially as the spec says that "Scalars cannot have fields.". Is there a correct way to handle these type of values?
Thanks!