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

Is it possible to upload a file optionally? #60

Closed
Genza999 opened this issue Apr 23, 2021 · 0 comments
Closed

Is it possible to upload a file optionally? #60

Genza999 opened this issue Apr 23, 2021 · 0 comments

Comments

@Genza999
Copy link

I have a mutation where I upload a file and other parameters too but this file can be omitted or included if need be. I am using graphene-file-upload for this, but when I try to omit the file from the request, I get the error.
In the operations section of my insomnia/postman, I remove the file variable:
from:
{ "query" : "mutation($file: Upload!, $name: String!){createPerson(file:$file, name: $name){success, errors}}", "variables" : { "file" : null, "name": "Kate", } }

to:
{ "query" : "mutation( $name: String!){createPerson(name: $name){success, errors}}", "variables" : { "name": "Kate", } }

The error:
{ "errors": [ { "message": "mutate() missing 1 required positional argument: 'file'", "locations": [ { "line": 1, "column": 61 } ], "path": [ "createPerson" ] } ], "data": { "createPerson": null } }
I guess since this file is included in the parameters of the mutate method.
Is there a way I could work around this? Thanks

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

1 participant