Forum Discussion
frantuma
4 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
- 4 years ago
Recent Discussions
- 6 days ago
- 7 days ago
- 24 days ago