Open jaydenseric opened 7 years ago
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: { ... }
}
@jaydenseric I agree. Do you want to make a PR?
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?
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
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.
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.
@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.
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 thisast
parameter?This looks pretty boilerplate, why not export the scalar resolver for easy setup?
Something like:
In the meantime, I can't work out how to get the resolver to work so any clarification would be super helpful.