{"id":15138460,"url":"https://github.com/asone/juniper-rocket-multipart","last_synced_at":"2026-01-18T23:33:28.186Z","repository":{"id":62444488,"uuid":"491399032","full_name":"Asone/juniper-rocket-multipart","owner":"Asone","description":"A handler for juniper with use of rocket that allows handling multipart requests in graphQL","archived":false,"fork":false,"pushed_at":"2022-05-25T14:47:23.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T05:45:35.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Asone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-12T06:56:20.000Z","updated_at":"2022-05-25T16:04:45.000Z","dependencies_parsed_at":"2022-11-01T23:33:36.673Z","dependency_job_id":null,"html_url":"https://github.com/Asone/juniper-rocket-multipart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asone%2Fjuniper-rocket-multipart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asone%2Fjuniper-rocket-multipart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asone%2Fjuniper-rocket-multipart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asone%2Fjuniper-rocket-multipart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Asone","download_url":"https://codeload.github.com/Asone/juniper-rocket-multipart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457807,"owners_count":20941912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T07:24:12.947Z","updated_at":"2026-01-18T23:33:28.068Z","avatar_url":"https://github.com/Asone.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Juniper Rocket Multipart\n\nThe current crate provides with a handler that allows using `multipart/data-form` requests on a [Rocket](https://rocket.rs/) webserver with [Juniper](https://github.com/graphql-rust/juniper).\n\nIt replicates the default behavior of Juniper for requests with `content-type` header of `application/json` and `application/graphql`. \n\n## Disclaimer \n\nThe current crate is a still on-going process as it lacks yet :\n\n- Unit tests\n- Rebuilding the provided map objects\n- Max bytes read per file is still hardcoded\n\nYet it should be functional. Use it at your own risks. \n\n## How to use \n\nYou can load the `GraphQLUploadWrapper` the same way you load the GraphQLRequest as both are data guards.\nThe main difference will be that instead, you'll call the\n execution of the query through the `operations` property\n of the wrapper.\n\n  Below is basic example :\n\n ```rust\n #[rocket::post(\"/upload\", data = \"\u003crequest\u003e\")]\n pub async fn upload\u003c'r\u003e(\n    request: GraphQLUploadWrapper,\n    schema: \u0026State\u003cSchema\u003e,\n ) -\u003e GraphQLResponse {\n    request.operations.execute(\u0026*schema, \u0026Context).await\n}\n ```\n\n ## Fetching the uploaded files\n\n In order to fetch the uploaded files\n You'll need to implement your own context object\n That will pass the buffered files to your execution methods.\n\n Example :\n ```rust\n struct Ctx{\n   files: Option\u003cHashMap\u003cString, TempFile\u003e\u003e\n };\n impl juniper::Context for Ctx {}\n ```\n\n You'll then be able to inject the buffered files to your\n operations like this :\n ```rust\n struct Ctx{ files: Option\u003cHashMap\u003cString, TempFile\u003e\u003e };\n impl juniper::Context for Ctx {}\n\n #[rocket::post(\"/upload\", data = \"\u003crequest\u003e\")]\n pub async fn upload\u003c'r\u003e(\n    request: GraphQLUploadWrapper,\n    schema: \u0026State\u003cSchema\u003e,\n ) -\u003e GraphQLResponse {\n   request.operations.execute(\u0026*schema, \u0026Ctx{ files: request.files }).await\n }\n ```\n\n ## Notes about processed files\n\n The Wrapper does nothing special with the uploaded files aside\n allocating them in heap memory through the Hashmap which means\n they won't be stored anywhere, not even in a temporary folder,\n unless you decide to.\n\n See [TempFile](./src/temp_file.rs) for more available data and information around uploaded files.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasone%2Fjuniper-rocket-multipart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasone%2Fjuniper-rocket-multipart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasone%2Fjuniper-rocket-multipart/lists"}