Skip to content
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

graphql-js object for custom scalars #176

Closed
Siras31 opened this issue Oct 14, 2016 · 6 comments
Closed

graphql-js object for custom scalars #176

Siras31 opened this issue Oct 14, 2016 · 6 comments

Comments

@Siras31
Copy link

Siras31 commented Oct 14, 2016

It would be great to be able to use custom scalars by passing a graphql-js object.

Then, we could use some great npm modules ;)

@stubailo
Copy link
Contributor

@Siras31 that's a great idea - it should be really easy, and probably the right syntax would be:

import GraphQLJSON from 'graphql-type-json';

export const schemaString = `
scalar JSON
`;

export const resolvers = {
  JSON: GraphQLJSON,
};

Want to send in a PR for it?

@stubailo stubailo added the help wanted Extra attention is needed label Oct 23, 2016
@ghost
Copy link

ghost commented Oct 26, 2016

Hello,

I'm trying to have this issue fixed. I began writing a patch :
https://github.com/oricordeau/graphql-tools/commit/7333cd3dfe5faba5e865e1022858989e422e5805

Can someone ( @stubailo ? ) have a look ? I'd like to know if I got it right. Any comment is welcome.

A few remarks :

  1. My commit comment was wrong so I referenced a PR which has nothing to do with this issue.
  2. Yes, I'll remove the commented console.log's before trying to making a PR
  3. The tests are all ok when I run "npm run test"
  4. ... but still, if it needs to be improved, just tell me !

Regards

@ghost
Copy link

ghost commented Oct 26, 2016

I wrote a little test app besides my fork of the the apollostack/graphql-tools repo, and here is what I get when I console.log(user) where user contains a User filled with mocked data :

{ id: -72,
  firstName: 'Hello World',
  lastName: 'Hello World',
  customJson: { kind: 'ObjectValue', value: '{"foo":"bar"}', name: 'JSON' } }

Is it the kind of thing which was expected ?

@stubailo
Copy link
Contributor

Would you mind opening a PR? Much easier to review that way!

@ghost
Copy link

ghost commented Oct 26, 2016

I created a PR :
/pull/189

FYI, I don't consider this as ready to be merged at all. I'd rather expect some comments about my diff. I didn't check the "Make sure all of the significant new logic is covered by tests" checkbox in the PR yet since I think more testing could be added. I'll work on it when I have some feedback. If someone has ideas of relevant test scenarios to add, I'm interested.

The task description was quite short and I'm new to this codebase, so I'm rather not sure about this PR so far. I'll fix things according to the feedback I get from people who know this code better than me.

@DxCx
Copy link
Contributor

DxCx commented Oct 29, 2016

oops @oricordeau just seen this after the actual review..
you can add "WIP" in your PR title to state that you are still working on this.
anyway thanks alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants