Apollo supported GraphQL multipart request specification, but I can't do something like this:
// type ImageInput = Type: String!, file: Upload!
mutation SaveFiles($images: [ImageInput]!) {
saveFiles(images: $images) {
... on Result { ... }
... on ValidationErrorsList { ... }
}
}
Implementation in project:
let image1 = ImageInput(type: .idCardFront, file: "0")
let image2 = ImageInput(type: .idCardBack, file: "1")
let img = (UIImage(named: "image")?.pngData())!
let file1 = GraphQLFile(fieldName: "images", originalName: "ImageFront.png", mimeType: "image/png", data: img)
let file2 = GraphQLFile(fieldName: "images", originalName: "ImageBack.png", mimeType: "image/png", data: img)
let mutation = SaveFiles(...)
apollo.upload(operation: mutation, files: [file1, file2])
After that, under the hud variables transform to:
// Apollo generate:
"variables": { "images": [null, null] }
// !!! but it should be:
"variables": { "images": [ {"Type": "idCardFront", file: null}, {"Type": "idCardBack", file: null} }
Under the hud file variable transform to: (see the code)
// Apollo generate:
map = {"0": "variable.images.0", "1": "variable.images.1"}
// But it should looks like:
map = {"0": "variable.images.0.file", "1": "variable.images.1.file"}
Unfortunately, I can't ask my server side to change implementation. Can you help me with this?
Apollo supported GraphQL multipart request specification, but I can't do something like this:
Implementation in project:
After that, under the hud variables transform to:
Under the hud file variable transform to: (see the code)
Unfortunately, I can't ask my server side to change implementation. Can you help me with this?