I’m having some trouble regarding the deployment/create endpoint to deploy multiple files using server-side auto generated code from the openApi documentation.
I’ve downloaded Camunda’s openApi json, converted to yaml and used it to generate code with openApi generator. However, the code generated is not compatible with the deployment implementation in the client side (Camunda). It simply puts a List of Files in a single Part which won’t work in Camunda.
I’d like to have the right openApi configuration to make openApi generator able to generate code that will be able deploy multiple files to Camunda.
I hope anyone is able to help me. Thank you in advance.
What happens is, when using the deployment/create endpoint, all files attached to the data attribute get the name data, which means I am sending each file as a duplicate making the last file the only winner left in camunda run.
Its like sending files with curl all having same key: -F data=my_model.bpmn -F data=task-form.html. The last one wins (task-form).
Analysis
The problem seems to be the MultiFormDeploymentDto specification in openapi.json with the snippet posted by @tiagorego21 :
"data": {
"type": "string",
"format": "binary",
"nullable": true,
"description": "The binary data to create the deployment resource.\nIt is possible to have more than one form part with different form part names for the binary data to create a deployment."
}
Question is: Can we describe data in such a way, that it does not generate files with duplicate names? Maybe making it a map of binaries?
I don’t know enough about openapi, yet, to answer that.
Thanks for the details, I didn’t have a chance to look into the issue yet.
However I think Markus might be on the right track, hopefully I will get back to you in the following days with my findings.
I was able to confirm the reported issue and created a bug report for it - CAM-13105.
However, I am not sure we can easily fix it in the OpenAPI documentation. Ideally we need to define an array of binary properties with undefined names. I am not certain if this is possible with the current specification or at least not exactly as we need it.
I tried the additionalProperties property but that definitely doesn’t work for OpenApi Generator (results in [ERROR] Map of form parameters not supported. Please report the issue to https://github.com/openapitools/openapi-generator if you need help.). There was better result in the generated client with swagger codegent client generator, but I didn’t test it thoroughly though as I am not convinced that it’s allowed to make such definition and it’s still not 100% correct. Example for reference: