Multipart with Java


I was referring to : Uploading files - Apollo GraphQL Docs. Is there a way to handle multipart in java with JVM outside of kotlin?

I tried upload a file but it doesn’t work as we do not work on JSON format. We have a custom format for the upload file, is there a way in which we can handle this usecase? When every i pass File object fails with below error

Error :java.lang.IllegalStateException: Cannot write test.sls to Json
at com.apollographql.apollo3.api.json.-JsonWriters.writeAny(JsonWriters.kt:40)
at com.apollographql.apollo3.api.Adapters$AnyAdapter$1.toJson(Adapters.kt:176)
at com.apollographql.apollo3.api.Adapters$AnyAdapter$1.toJson(Adapters.kt:184)
at com.vmware.guardrails.e2e.adapter.CreateTemplateMutation_VariablesAdapter.toJson(


Hi! :wave:

Did you declare the custom scalar used for uploads with mapScalarToUpload?

Yeah it was tried but face same issue during gralew build because it trying to convert the multipart file to json again. Do we support any other file formats other than json.

Hmm, I’m not entirely sure of what you mean by JSON in this context.

Could you show what you tried in the gradle plugin configuration, and in your code, as well as the GraphQL mutation and the relevant part of your GraphQL schema?