Dealing with File uploading migration 2.0->3.0
tl;dr -> Before we were passing in a path string to FileUpload(mimeType,
path) but now I’m not sure what’s the functionally equivalent thing to do.
We used to do:
// graphqls
mutation UploadFile($file: Upload!){
uploadFile(file: $file) { //stuff }
}
uploadFile(file: Upload!): File!
type File { // stuff }
// kt
private suspend fun uploadFile(path: String, mimeType: String): Response<UploadFileMutation.Data> {
val uploadFileMutation = UploadFileMutation(
file = FileUpload(mimeType, path)
)
return apolloClient.mutation(uploadFileMutation).execute()
}
and it’d work. Mind you, we were calling this method once with a file that we did
.path
on it, and once on a
Uri
that we did
.path
on it too. (so not all of our cases can be fixed with the
Now with the
new documentation mentioning “okioSource” as someone who has never worked with okio it’s not obvious what I should do to not break this. Maybe worth a mention in the migration logs? At least a link to okio documentation on this?