Closed jackovsky8 closed 6 months ago
If I use the class FileUpload in a Rest Service, it somehow overwrites the generated Openapi Specs.
I have a quarkus application where I defined a resource with two files in a multipart/form-data upload:
@Path("v1") public interface IMultiPartResource { @POST @Path("/multipart") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) Object multipart( @RequestBody( description = "The multipart data.", required = true, content = @Content( mediaType = MediaType.MULTIPART_FORM_DATA, schema = @Schema( type = SchemaType.OBJECT, properties = { @SchemaProperty(name = "data1", type = SchemaType.STRING, format = "binary"), @SchemaProperty(name = "data2", type = SchemaType.STRING, format = "binary"), } ))) @NotNull @RestForm("data1") FileUpload data1, @RestForm("data2") Optional<FileUpload> data2, }
My Problem is, that the generated openapi spec is not correct. It produces something like:
--- ... /clv-api/v1/importer/gino-production-data: post: requestBody: description: "The multipart data." content: multipart/form-data: schema: type: object properties: data1: $ref: '#/components/schemas/FileUpload' data2: $ref: '#/components/schemas/FileUpload' required: true ... components: schemas: FileUpload: type: object
But I expect something like that:
--- ... /clv-api/v1/importer/gino-production-data: post: requestBody: description: "The multipart data." content: multipart/form-data: schema: type: object properties: data1: type: string format: binary data2: type: string format: binary required: true ... components: schemas: FileUpload: type: object
It works correctly, if a use the class "File".
For it to not overwrite the Openapi Specs, like how it is supposed to work.
See above.
No response
uname -a
ver
java -version
mvnw --version
gradlew --version
mvn --version Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f)
/cc @EricWittmann (openapi), @MikeEdgar (openapi), @phillip-kruger (openapi)
https://github.com/quarkusio/quarkus/issues/39950
Closing here. Duplicate
Describe the bug
If I use the class FileUpload in a Rest Service, it somehow overwrites the generated Openapi Specs.
I have a quarkus application where I defined a resource with two files in a multipart/form-data upload:
My Problem is, that the generated openapi spec is not correct. It produces something like:
But I expect something like that:
It works correctly, if a use the class "File".
Expected behavior
For it to not overwrite the Openapi Specs, like how it is supposed to work.
Actual behavior
See above.
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)mvn --version Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f)
Additional information
No response