Skip to content

Support file uploads #27

Open
Open
@sreerajkksd

Description

@sreerajkksd

Is your feature request related to a problem? Please describe.
Client need to upload files to the graphql backed server.
Describe the solution you'd like
Server implement graphql file upload using some custom libraries (eg: using the spec mentioned here and implementation here).

Describe alternatives you've considered
Doing it natively using requests library is an option, but there are some overheads and graphql client library is the best place to put it. Looks like not a lot client libraries (available for python) out there support file uploads.

Additional context

The implementation would be something like this:

Inputs: query: str, variables: dict, operationName: str, files: BinaryIO

Generate the following fields:

operations:{"query": "mutation uploadFiles($files: [Upload]) {uploadFiles(files: $files) { success }", "variables": { "files": [null,null] }}
map:{ "0": ["variables.files.0"], "1": ["variables.files.1"]}

And files can be kept in a key value pair where key is the stringified index (eg: "0" or "1") and value is the opened file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions