Forum Discussion
frantuma
3 years agoStaff
ATM @Schema annotation doesn't allow to specify properties
and additionalProperties
part of the schema, if not by referring to an existing class via implementation
, as you mentioned. We have this enhancement (annotations + processing) in our roadmap, but for the moment you can either apply the implementation
workaround by e.g. defining some POJOs like the following:
...
class ExternalUserDTO {
String foo;
}
class RoomOptionsDTO {
public String bar;
}
@Schema(requiredProperties = {"user", "options"}
class UserAndRoomDTO {
public RoomOptionsDTO options;
public ExternalUserDTO user;
}
...
requestBody = @RequestBody(
content = @Content(
mediaType = MediaType.MULTIPART_FORM_DATA,
schema = @Schema(
implementation = UserAndRoomDTO.class)
or use one of the extension mechanism, e.g. filters (https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Extensions#filters)
Related Content
- 8 months agoRichardPla
- 3 years agoaaronpliu
Recent Discussions
- 10 hours agoBartMadeBotBad
- 22 hours agosuhaskr
- 11 days agoPrathik
swagger- specific_Api
Solved15 days agoyos123- 17 days agoozfarooq