From 921cd0e751eb52a59ddc5ca8e1a941b0869053bd Mon Sep 17 00:00:00 2001 From: Warded120 Date: Fri, 6 Dec 2024 10:48:02 +0200 Subject: [PATCH] added custom swagger schema for FilterEventDto --- .../java/greencity/controller/EventController.java | 6 +++++- .../java/greencity/dto/filter/FilterEventDto.java | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/greencity/controller/EventController.java b/core/src/main/java/greencity/controller/EventController.java index 737a95d14..dfef735cc 100644 --- a/core/src/main/java/greencity/controller/EventController.java +++ b/core/src/main/java/greencity/controller/EventController.java @@ -179,7 +179,11 @@ public ResponseEntity getEvent( public ResponseEntity> getEvents( @Parameter(hidden = true) Pageable pageable, @RequestParam(required = false, name = "user-id") Long userId, - FilterEventDto filterEventDto) { + @Schema( + description = "Filters for events", + name = "FilterEventDto", + type = "object", + example = FilterEventDto.defaultJson) FilterEventDto filterEventDto) { if (filterEventDto != null && filterEventDto.getStatuses() != null) { validateStatusesRequireUserId(filterEventDto.getStatuses(), userId); } diff --git a/service-api/src/main/java/greencity/dto/filter/FilterEventDto.java b/service-api/src/main/java/greencity/dto/filter/FilterEventDto.java index 4320a709b..e6c35f90d 100644 --- a/service-api/src/main/java/greencity/dto/filter/FilterEventDto.java +++ b/service-api/src/main/java/greencity/dto/filter/FilterEventDto.java @@ -23,4 +23,17 @@ public class FilterEventDto { private EventType type; private ZonedDateTime from; private ZonedDateTime to; + + public static final String defaultJson = """ + { + "time": null, + "cities": [], + "statuses": [], + "tags": [], + "title": null, + "type": null, + "from": null, + "to": null + } + """; }