I'm using OAS3 codegenerator to create Kotlin server code for a request containing both a file-upload, and a free-form json object that can contain arbitrary values. According to the swagger documentation, I should be able to create a free-form object that using type: object
and additionalProperties : true
.
However if I edit the upload photos endpoint in modules/openapi-generator/src/test/resources/3_0/petstore.yaml
in the oas3 codegen samples like this
requestBody:
content:
multipart/form-data:
schema:
properties:
file:
description: file to upload
type: string
format: binary
additionalMetadata:
description: Additional data to pass to server
type: object <-- CHANGED FROM STRING
additionalProperties: true <-- ADDED
and run ./bin/generate-samples.sh ./bin/configs/kotlin-server-jaxrs-spec.yaml
the additionalMetadata field is dropped from PetApi
@POST
@Consumes("multipart/form-data")
@Produces("application/json")
suspend fun uploadFile(@PathParam("petId") petId: kotlin.Long, @FormParam(value = "file") fileInputStream: InputStream?): Response {
Is there a problem with how I'm specifying the request?