Hey guys how to implement swagger for upload file ...
# server
j
Hey guys how to implement swagger for upload file as multipartFile with RouterOperation and using Router?
a
We're using https://github.com/SMILEY4/ktor-swagger-ui and did it like this:
Copy code
val swaggerDescription: OpenApiRoute.() -> Unit = {
        description = "Upload a bannerd"
        request {
            multipartBody {
                description = "Upload a banner for an event by id and file"
                required = true
                mediaType(ContentType.MultiPart.FormData)
                part<UUID>("id")
                part<File>("banner") {
                    mediaTypes =
                        setOf(
                            ContentType.Image.PNG,
                            ContentType.Image.JPEG,
                            ContentType.Image.GIF,
                        )
                }
            }
        }
    }
j
Thank you so much. I appreciate it. Can you suggest any lib also for Spring projects, please?)