microprofile-open-api: Properties can not be defined in @Schema
@agiertli asked on Gitter (Jun 24 15:28) following question:
Hi folks,
I am trying to annotate a parameter which holds an uploaded file in my POST request:
The final OpenAPI spec should look like this: https://swagger.io/docs/specification/describing-request-body/file-upload/
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
fileName:
type: string
format: binary
I can’t seem to find a suitable way how to define ‘properties’., when using MicroProfile annotations for OpenAPI. So far, I have this:
public Response processInvoice(
@RequestBody(content = @Content(mediaType = "multipart/form-data", schema = @Schema(type = SchemaType.OBJECT))) MultipartFormDataInput input)
Which generates:
requestBody:
content:
multipart/form-data:
schema:
type: object
So it seems I am on the right track, but not sure how to proceed further…any ideas?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- Add example of properties from #360, update SchemaProperty copyright Signed-off-by: Michael Edgar <michael@xlate.io> — committed to MikeEdgar/microprofile-open-api by MikeEdgar 5 years ago
- Merge pull request #384 from MikeEdgar/360_schema_properties Add SchemaProperty Annotation (#360) — committed to eclipse/microprofile-open-api by arthurdm 4 years ago
I agree with the above proposal
I think that a fairly simple solution to this (and perhaps one that is not controversial) would be to introduce
propertiesto the@Schemaannotation. So for example, an application of the@Schemaannotation might look like this:This would allow the developer to describe any properties at all.