diff options
author | Vitaly Takmazov | 2023-01-13 17:38:06 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 18:11:56 +0300 |
commit | 35d25bbc9d261e7b5585d0fd1d398dff3ab4a176 (patch) | |
tree | 68a4d0b0190635615438343f6f6c52cacc213179 /src/main/java/com/juick/www/api/Notifications.java | |
parent | 8b70eded6c9cc3b9cf634356239701fe65779791 (diff) |
Fix OpenAPI generation
* Use HandlerMethodArgumentResolver to pass visitor
* Hide visitor from OpenAPI definitions
* Drop unused AsciiDoc template
Diffstat (limited to 'src/main/java/com/juick/www/api/Notifications.java')
-rw-r--r-- | src/main/java/com/juick/www/api/Notifications.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/juick/www/api/Notifications.java b/src/main/java/com/juick/www/api/Notifications.java index 32ba3dc1..e5e85eb7 100644 --- a/src/main/java/com/juick/www/api/Notifications.java +++ b/src/main/java/com/juick/www/api/Notifications.java @@ -22,6 +22,7 @@ import com.juick.service.*; import com.juick.util.HttpBadRequestException; import com.juick.util.HttpForbiddenException; import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Parameter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; @@ -71,7 +72,7 @@ public class Notifications { @Hidden @RequestMapping(value = "/api/notifications", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List<User> doGet( - @ModelAttribute(binding = false) User visitor, + @Parameter(hidden = true) User visitor, @RequestParam(required = false, defaultValue = "0") int uid, @RequestParam(required = false, defaultValue = "0") int mid, @RequestParam(required = false, defaultValue = "0") int rid) { @@ -110,7 +111,7 @@ public class Notifications { @Hidden @RequestMapping(value = "/api/notifications", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) public Status doDelete( - @ModelAttribute User visitor, + @Parameter(hidden = true) User visitor, @RequestBody List<ExternalToken> list) { if (!visitor.equals(serviceUser)) { throw new HttpForbiddenException(); @@ -129,7 +130,7 @@ public class Notifications { @Hidden @RequestMapping(value = "/api/notifications/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public Status doDeleteTokens( - @ModelAttribute User visitor, + @Parameter(hidden = true) User visitor, @RequestBody List<ExternalToken> list) { if (!visitor.equals(serviceUser)) { throw new HttpForbiddenException(); @@ -149,7 +150,7 @@ public class Notifications { @Hidden @RequestMapping(value = "/api/notifications", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public Status doPut( - @ModelAttribute User visitor, + @Parameter(hidden = true) User visitor, @RequestBody List<ExternalToken> list) { list.forEach(t -> { switch (t.type()) { @@ -165,7 +166,7 @@ public class Notifications { @Deprecated @RequestMapping(value = "/api/android/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Status doAndroidRegister( - @ModelAttribute User visitor, + @Parameter(hidden = true) User visitor, @RequestParam(name = "regid") String regId) { pushQueriesService.addGCMToken(visitor.getUid(), regId); return Status.OK; @@ -174,7 +175,7 @@ public class Notifications { @Deprecated @RequestMapping(value = "/api/winphone/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Status doWinphoneRegister( - @ModelAttribute User visitor, + @Parameter(hidden = true) User visitor, @RequestParam(name = "url") String regId) { pushQueriesService.addMPNSToken(visitor.getUid(), regId); return Status.OK; |