-
Notifications
You must be signed in to change notification settings - Fork 2k
Convert arbitrary scalars to AST. #1815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@anhldbk That's why we implemented graphql-js/src/utilities/valueFromASTUntyped.js Lines 18 to 36 in 8aef229
Moreover it's used by default: graphql-js/src/type/definition.js Line 563 in 8aef229
So you don't need to use package for it just do: GraphQLScalarType({
name: 'JSON',
serialize: (value) => value,
}); |
@IvanGoncharov Thank you for your hint. But would you please tell me how to properly parse JSON-enabled value into AST? I have to patch by adding following lines before L139 if (typeof serialized === 'object' ){
return {
kind: _kinds.Kind.OBJECT,
value: serialized
};
} |
@anhldbk Yes, it looks like a bug. We should support scalars that are serialized to complex values. |
Hi guys,
I'm trying to make a configuration language based on GraphQL (so I don't have write lexer/parser on my own). I want to support JSON as an input type by using
graphql-type-json
. But I've got an issue of parsing AST as described by this issue taion/graphql-type-json#73.@taion tell me that
I've found a hack to overcome the issue. Should I make a PR against this one?
The text was updated successfully, but these errors were encountered: