The following is an excempt from my OpenAPI specification that I use to generate my angular services with openapi-generator-cli
:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
test:
type: array
items:
type: string
format: byte
This request body fails to generate with the following warning output in the generation process:
[main] WARN o.o.codegen.DefaultCodegen - Could not compute datatypeWithEnum from string, null
I originally had a more complex structure of schemas, but I narrowed it down to this part: an object with a property that is an array containing a byte array (putting the items of the array in an object has no impact). If I were to move the byte array property into the test object, it generates, but as soon as I have one or multiple arrays containing the byte array it does not work anymore.
I run the generator command through npm as a script:
"openapi-generator-cli generate -i ../../../../openapi/openapi.yaml -g typescript-angular -o src/generated-sources/openapi --additional-properties=supportsES6=true,npmVersion=6.9.0,ngVersion=14",
Previously I had the content type set to application/json
and it worked fine, simply changing the content type to multipart/form-data
made it not work anymore and I sadly am required to use multipart/form-data
in the future.
Help or suggestions are highly appreciated
What I have tried:
- Using
binary
and orbase64
as the format - OpenAPI generator versions 5.1.1 and 6.4.0
- turning on verbose logging (no extra lines of warning or errors are output)
- reducing my more complex datastructure to the shown example
- read through following post: OpenAPI Example multipart form data which seems to depict a very similar datastructure but it seems to work(?)
- found OpenAPI V3 Maven Plugin generates incomplete interface code with multiple file upload using multipart/form-data which seems to describe a similar issue but with a java generator
- found and tried solution from swagger-ui - open api 3, multipart/form-data array problem (change name of property to include
[]
brackets) with no change in outcome