-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I use latest swagger 2.1.2, springdoc 1.3.1, spring boot 2.2.6 (MVC stack)
For example, one endpoint from my controller:
@PostMapping(Routes.Item.External.ITEM_BY_ID_PHOTO)
public ActionResult<Long> uploadImage(
@PathVariable("id") @Min(1) long itemId,
@AuthenticationPrincipal User principal,
@RequestBody @Validated Base64ImageRequest req
) {
final Long sellerId = principal.getCurrentAgent().isSeller() ? principal.getCurrentSellerId() : null;
return ActionResult.ok(this.imageService.createImage(itemId, sellerId, req));
}
Request model Base64ImageRequest
:
public class Base64ImageRequest {
private short order;
@NotNull
private byte[] image;
}
An example of a valid request:
{
"order": 5,
"image": "someBase64Image"
}
It was expected that the generated specification with such a structure for this request:
"Base64ImageRequest": {
"required": [
"image"
],
"type": "object",
"properties": {
"order": {
"type": "integer",
"format": "int32"
},
"image": {
"type": "string"
}
}
}
But at the output, it turns out that the image field is interpreted as an array of strings.
"Base64ImageRequest": {
"required": [
"image"
],
"type": "object",
"properties": {
"order": {
"type": "integer",
"format": "int32"
},
"image": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
}
}
}
}
The problem is here
This line returns for field image
io.swagger.v3.oas.models.media.ArraySchema
instead of io.swagger.v3.oas.models.media.StringSchema
Metadata
Metadata
Assignees
Labels
No labels