Description
When an OpenAPI schema declares an array of binary strings (multiple file upload), the generator maps the array items to String instead of MultipartFile, producing List<String> in the generated model.
A single binary property is handled correctly (MultipartFile), so only the array/collection case is affected.
Steps to reproduce
Given a schema property such as:
Document:
type: object
properties:
document:
type: string
format: binary
attachments:
type: array
items:
type: string
format: binary
Actual result
private MultipartFile document; // OK
private List<String> attachments; // wrong
Expected result
private MultipartFile document;
private List<MultipartFile> attachments;
Root cause
ModelBuilder.processArray(...) resolves the element type of a simple (non-$ref, non-composed, no-properties) array item through MapperUtil.getSimpleType(items, ...). getSimpleType has no binary detection (it never calls ApiTool.isBinary), so a { type: string, format: binary } item falls through to "string".
Binary → MultipartFile is only applied for scalar object properties, in ModelBuilder.processStringProperty(...), never for array items.
The same gap applies to the OpenAPI 3.1 style (contentEncoding / contentMediaType), since ApiTool.isBinary already covers both but is not consulted on the array path.
Environment
- Affects the OpenAPI code generator (
multiapi-engine).
- Reproduced on
main.
Description
When an OpenAPI schema declares an array of binary strings (multiple file upload), the generator maps the array items to
Stringinstead ofMultipartFile, producingList<String>in the generated model.A single binary property is handled correctly (
MultipartFile), so only the array/collection case is affected.Steps to reproduce
Given a schema property such as:
Actual result
Expected result
Root cause
ModelBuilder.processArray(...)resolves the element type of a simple (non-$ref, non-composed, no-properties) array item throughMapperUtil.getSimpleType(items, ...).getSimpleTypehas no binary detection (it never callsApiTool.isBinary), so a{ type: string, format: binary }item falls through to"string".Binary →
MultipartFileis only applied for scalar object properties, inModelBuilder.processStringProperty(...), never for array items.The same gap applies to the OpenAPI 3.1 style (
contentEncoding/contentMediaType), sinceApiTool.isBinaryalready covers both but is not consulted on the array path.Environment
multiapi-engine).main.