-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I am observing some unexpected behaviour for nullable (meaning optional) File and Fileuploads.
package org.example
import jakarta.ws.rs.POST
import jakarta.ws.rs.Path
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType
import org.eclipse.microprofile.openapi.annotations.media.Schema
import org.jboss.resteasy.reactive.RestForm
import org.jboss.resteasy.reactive.multipart.FileUpload
import java.io.File
@Path("/hello")
class ExampleResource {
@POST
@Path("/int")
fun postInt(@RestForm int: Int): String {
// Do nothing
return "Int"
}
@POST
@Path("/intNullable")
fun postNullableInt(@RestForm int: Int?): String {
// Do nothing
return "Int?"
}
@POST
@Path("/string")
fun postString(@RestForm string: String): String {
// Do nothing
return "String"
}
@POST
@Path("/stringNullable")
fun postNullableString(@RestForm string: String?): String {
// Do nothing
return "String?"
}
@POST
@Path("/file")
fun postFile(@RestForm file: File): String {
// Do nothing
return "File"
}
@POST
@Path("/fileNullable")
fun postNullableFile(@RestForm file: File?): String {
// Do nothing
return "File?"
}
@POST
@Path("/fileNullableFix")
fun postNullableFileWithFix(@RestForm @Schema(implementation = BinaryStringSchema::class) file: File?): String {
// Do nothing
return "File?"
}
@POST
@Path("/fileupload")
fun postFileUpload(@RestForm fileUpload: FileUpload): String {
// Do nothing
return "FileUpload"
}
@POST
@Path("/fileuploadNullable")
fun postNullableFileUpload(@RestForm fileUpload: FileUpload?): String {
// Do nothing
return "FileUpload?"
}
@POST
@Path("/fileuploadNullableFix")
fun postNullableFileUploadWithFix(@RestForm @Schema(implementation = BinaryStringSchema::class) fileUpload: FileUpload?): String {
// Do nothing
return "FileUpload?"
}
}
@Schema(type = SchemaType.STRING, format = "binary")
interface BinaryStringSchemaFile (upload button):
File? (without upload button):
File? (with schema workaround):
The behaviour works as expected for nullable Ints and Strings, but it breaks for nullable Files and FileUploads (potentially others too?).
I would expect a nullable File(Upload) to have upload buttons just like non-nullable File(Upload).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working


