Last active
September 12, 2020 10:19
-
-
Save epalaz/c0d7474b7085ecfc1827a2e963278cd5 to your computer and use it in GitHub Desktop.
Type Definitions for File Upload Mutations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const typeDefs = gql` | |
type File { | |
filename: String! | |
mimetype: String! | |
encoding: String! | |
} | |
type Query { | |
_ : Boolean // Added here to satisfy requirement of having at least one query defined | |
} | |
type Mutation { | |
singleUpload(file: Upload!): File!, | |
singleUploadStream(file: Upload!): File! | |
} | |
`; | |
It is added added as a scalar type by Apollo Server so it is already a defined scalar as default. You can see details and resolver in this README of graphql-upload package.
Thanks @epalaz
Error: Unknown type "Upload". Did you mean "Float"?
please
Error: Unknown type "Upload". Did you mean "Float"?
please
import { GraphQLUpload } from 'graphql-upload';
const { makeExecutableSchema } = require('graphql-tools');
const { GraphQLUpload } = require('graphql-upload');
const schema = makeExecutableSchema({
typeDefs: /* GraphQL */ `
scalar Upload
`,
resolvers: {
Upload: GraphQLUpload,
},
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At line 15,16 , input type
Upload!
is not defined anywhere, Could you please explain, what is its definition?