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

Export UploadedFile scalar resolver #9

Open
jaydenseric opened this issue Jan 25, 2017 · 7 comments
Open

Export UploadedFile scalar resolver #9

jaydenseric opened this issue Jan 25, 2017 · 7 comments

Comments

@jaydenseric
Copy link

Step 3 in the instructions, "Add UploadedFile resolver" is too hard to follow.

Pasting the example code into a typical Apollo resolvers.js file wont work because Kind is undefined. Where does that come from, how do you import it? And what is this ast parameter?

This looks pretty boilerplate, why not export the scalar resolver for easy setup?

Something like:

import {UploadedFileResolver} from 'graphql-server-express-upload'

export default {
  UploadedFile: UploadedFileResolver,
  Query: { ... },
  Mutation: {  ... }
}

In the meantime, I can't work out how to get the resolver to work so any clarification would be super helpful.

@jaydenseric
Copy link
Author

I got this working by dropping in taion/graphql-type-json. The name is JSON, when ideally it would be UploadedFile, but it seems to be working ok.

import GraphQLJSON from 'graphql-type-json'
export default {
  UploadedFile: GraphQLJSON,
  Query: { ... },
  Mutation: {  ... }
}

@HriBB
Copy link
Owner

HriBB commented Jan 25, 2017

@jaydenseric I agree. Do you want to make a PR?

@jaydenseric
Copy link
Author

Perhaps, I am in the middle of some epic refactoring but might be in a place to look at it sometime in the next few days.

The importable resolver might be better placed in HriBB/apollo-upload-network-interface so it does not have to be duplicated for future non-express middleware. Thoughts?

@HriBB
Copy link
Owner

HriBB commented Jan 25, 2017

Yeah I am very busy ATM as well ... will try to update all packages in a batch sometimes soon.

I think that scalar should be a part of the server package(s), because it is not needed on the client. Or it could be a part of some external package or even its own package. I was thinking about using lerna for package management and typescript. Check out this issue

@jaydenseric
Copy link
Author

jaydenseric commented Jan 25, 2017

A benefit to keeping it here is the graphql dependency; it already exists here but not yet in apollo-upload-network-interface.

I for one can't stand TypeScript in OSS, it's not real JavaScript and it makes contributing or even understanding the source difficult. A lot of traffic seems to be about fiddling around with types.

@vladinator1000
Copy link

I would love to find out more about this. I've been trying to upload a file for a couple of weeks but no luck.

@jaydenseric
Copy link
Author

@savovs If you're still stuck, you might find apollo-upload-server a little easier to get up and running – you don't have to set up a custom scalar or Multer.

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

3 participants