Regarding Multipart/mixed


#1

We are using raml parser to generate the java interfaces. Everything is working fine except the following interfaces. We are using multipart/mixed content type to upload the multiple files (from our existing clients).

post:
description: description
is: [protected]
body:
multipart/mixed:
schema: postFile.json
example: !include examples/postFileExample.json
responses:
201:

Once we generate the interface for above action. The appropriate is class for multipart/mixed is not getting generated. It generating Reader class for multipart/mixed mime type (Refer the next code snippet).

@POST
@Path("{fileId}")
@Consumes(“multipart/mixed”)
@Produces({
“application/json”
})
FileResource.PostFilesByFileIdResponse postFilesByFileId(
@PathParam(“fileId”)
String fileId,
Reader entity)
throws Exception

I have checked with other mime types “multipart/form-data”, its generating the relevant class “MimeMultipart” in java code. Can some body let me know what changes I should do for multipart/mixed mime type, so that relevant class get generated instead of Reader class? I am using mulesoft raml parser to generate the code. Anyone has achieved the same ?


#2

So I am not really sure how these code generation tools are working, but RAML is not really mandating what mime type is supported or not. You could basically define what ever you want as RAML basically just describes the capabilities of your service. Tooling on the other hand needs to support these mime types and I am not really sure if yours does.

What are you using in particularly to generate your code?


#3

Yes, Its nothing to do with RAML, I posted this query thinking that, if somebody has achieved the same may help us resolving our issue bit quicker. we are using mulesoft parser. we are unable to generate the code for multipart/mixed. Anyway thanks for you time.


#4

You could raise an issue for that and see what MuleSoft is responding.