Description
Have you ever had to work with multipart data uploads? When used with resource based routing, the route looks like:
post { _: VideoResource.Upload, multipart: MultiPartData ->
Unfortunately this generates a scheme reference in the openapi spec and it doesn't really work as expected. Which is fine, because it doesn't seem like ktor-docs advertises multipart support.
Here is what is generated:
application/json:
schema:
$ref: "#/components/schemas/io.ktor.http.content.MultiPartData"
but it should be something like:
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
description:
type: string
description: Video description
video:
type: string
format: binary
description: Video file to upload
encoding:
video:
contentType: video/mov, video/quicktime, video/gif, image/gif, video/webm
I think the best way to support this is probably via an annotation, because its additional information outside of the ktor request (contentType is at least, so we might as well take it all in via annotation). It would be nice if we could utilize @KtorFieldDescription for the properties in the multipart upload, but it would require a small refactor which would increase its responsibilities.
OpenAPI reference - https://swagger.io/docs/specification/v3_0/describing-request-body/multipart-requests/
Ktor reference - https://ktor.io/docs/server-requests.html#form_data