You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an OpenAPI schema that describes a file upload supporting multiple files, the generated kotlin code fails to compile.
This started after the 7.0.0 release (the kotlin code compiles successfully in 6.6.0, but I suspect it only supports a single file).
openapi-generator version
7.4.0 (issue introduced in 7.0.0)
OpenAPI declaration file content or url
testcase.yaml:
openapi: 3.0.0info:
version: "1.0.0"title: TestAPIservers:
- url: https://api.example.com/description: API endpointpaths:
/file-upload:
post:
operationId: uploadFilerequestBody:
content:
multipart/form-data:
schema:
type: objectproperties:
# The property name 'file' will be used for all files.file:
type: arrayitems:
type: stringformat: binaryresponses:
'204':
description: File uploaded
Create the testcase.yaml and testconfig.json as described in this issue.
Run the code generation, then run ./gradlw clean assemble to try to build the kotlin client.
The following error is reported:
> Task :compileCommonMainKotlinMetadata FAILED
e: file:///***/generated_test/src/commonMain/kotlin/com/example/kotlin/api/apis/DefaultApi.kt:56:23 Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun <T, C : Iterable<TypeVariable(T)>> TypeVariable(C).onEach(action: (TypeVariable(T)) -> Unit): TypeVariable(C) defined in kotlin.collections
public inline fun <K, V, M : Map<out TypeVariable(K), TypeVariable(V)>> TypeVariable(M).onEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): TypeVariable(M) defined in kotlin.collections
public inline fun <S : CharSequence> TypeVariable(S).onEach(action: (Char) -> Unit): TypeVariable(S) defined in kotlin.text
public inline fun <T> Array<out TypeVariable(T)>.onEach(action: (TypeVariable(T)) -> Unit): Array<out TypeVariable(T)> defined in kotlin.collections
public inline fun BooleanArray.onEach(action: (Boolean) -> Unit): BooleanArray defined in kotlin.collections
public inline fun ByteArray.onEach(action: (Byte) -> Unit): ByteArray defined in kotlin.collections
public inline fun CharArray.onEach(action: (Char) -> Unit): CharArray defined in kotlin.collections
public inline fun DoubleArray.onEach(action: (Double) -> Unit): DoubleArray defined in kotlin.collections
public inline fun FloatArray.onEach(action: (Float) -> Unit): FloatArray defined in kotlin.collections
public inline fun IntArray.onEach(action: (Int) -> Unit): IntArray defined in kotlin.collections
public inline fun LongArray.onEach(action: (Long) -> Unit): LongArray defined in kotlin.collections
public inline fun ShortArray.onEach(action: (Short) -> Unit): ShortArray defined in kotlin.collections
public inline fun UByteArray.onEach(action: (UByte) -> Unit): UByteArray defined in kotlin.collections
public inline fun UIntArray.onEach(action: (UInt) -> Unit): UIntArray defined in kotlin.collections
public inline fun ULongArray.onEach(action: (ULong) -> Unit): ULongArray defined in kotlin.collections
public inline fun UShortArray.onEach(action: (UShort) -> Unit): UShortArray defined in kotlin.collections
public fun <T> Sequence<TypeVariable(T)>.onEach(action: (TypeVariable(T)) -> Unit): Sequence<TypeVariable(T)> defined in kotlin.sequences
e: file:///***/generated_test/src/commonMain/kotlin/com/example/kotlin/api/apis/DefaultApi.kt:57:38 Unresolved reference: it
The generated API method looks like this (onEach is not supported since the file variable is not a collection):
Uh oh!
There was an error while loading. Please reload this page.
Bug Report Checklist
Description
When using an OpenAPI schema that describes a file upload supporting multiple files, the generated kotlin code fails to compile.
This started after the 7.0.0 release (the kotlin code compiles successfully in 6.6.0, but I suspect it only supports a single file).
openapi-generator version
7.4.0 (issue introduced in 7.0.0)
OpenAPI declaration file content or url
testcase.yaml:
testconfig.json:
Generation Details
Steps to reproduce
./gradlw clean assemble
to try to build the kotlin client.The following error is reported:
The generated API method looks like this (
onEach
is not supported since the file variable is not a collection):I'm a bit unsure what the expected output is, but the output when using v6.6.0 was this for the formData:
I would guess this only supports a single file, though, unless InputProvider can hold multiple files.
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: