From c8c4c8ad3e50e314fc7382d3307f0867639bfae4 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 10 Apr 2024 11:09:09 +0100 Subject: [PATCH] cleanup swagger docs --- .../controller/PlayerController.java | 15 +++++---------- .../controller/ServerController.java | 12 ++++-------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/cc.fascinated/controller/PlayerController.java b/src/main/java/cc.fascinated/controller/PlayerController.java index 7b294f6..52d9c24 100644 --- a/src/main/java/cc.fascinated/controller/PlayerController.java +++ b/src/main/java/cc.fascinated/controller/PlayerController.java @@ -31,8 +31,7 @@ public class PlayerController { @ResponseBody @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getPlayer( - @Parameter(description = "The UUID or Username of the player", example = "ImFascinated") - @PathVariable String id) { + @Parameter(description = "The UUID or Username of the player", example = "ImFascinated") @PathVariable String id) { return ResponseEntity.ok() .cacheControl(cacheControl) .body(playerManagerService.getPlayer(id)); @@ -40,14 +39,10 @@ public class PlayerController { @GetMapping(value = "/{part}/{id}") public ResponseEntity getPlayerHead( - @Parameter(description = "The part of the skin", example = "head") - @PathVariable String part, - @Parameter(description = "The UUID or Username of the player", example = "ImFascinated") - @PathVariable String id, - @Parameter(description = "The size of the image", example = "256") - @RequestParam(required = false, defaultValue = "256") int size, - @Parameter(description = "Whether to download the image") - @RequestParam(required = false, defaultValue = "false") boolean download) { + @Parameter(description = "The part of the skin", example = "head") @PathVariable String part, + @Parameter(description = "The UUID or Username of the player", example = "ImFascinated") @PathVariable String id, + @Parameter(description = "The size of the image", example = "256") @RequestParam(required = false, defaultValue = "256") int size, + @Parameter(description = "Whether to download the image") @RequestParam(required = false, defaultValue = "false") boolean download) { Player player = playerManagerService.getPlayer(id); Skin.Parts skinPart = Skin.Parts.fromName(part); String dispositionHeader = download ? "attachment; filename=%s.png" : "inline; filename=%s.png"; diff --git a/src/main/java/cc.fascinated/controller/ServerController.java b/src/main/java/cc.fascinated/controller/ServerController.java index 8be37c3..f508e6f 100644 --- a/src/main/java/cc.fascinated/controller/ServerController.java +++ b/src/main/java/cc.fascinated/controller/ServerController.java @@ -23,10 +23,8 @@ public class ServerController { @ResponseBody @GetMapping(value = "/{platform}/{hostnameAndPort}", produces = MediaType.APPLICATION_JSON_VALUE) public CachedMinecraftServer getServer( - @Parameter(description = "The platform of the server", example = "java") - @PathVariable String platform, - @Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") - @PathVariable String hostnameAndPort) { + @Parameter(description = "The platform of the server", example = "java") @PathVariable String platform, + @Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostnameAndPort) { Tuple host = ServerUtils.getHostnameAndPort(hostnameAndPort); return serverService.getServer(platform, host.getLeft(), host.getRight()); } @@ -34,10 +32,8 @@ public class ServerController { @ResponseBody @GetMapping(value = "/icon/{hostnameAndPort}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getServerIcon( - @Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") - @PathVariable String hostnameAndPort, - @Parameter(description = "Whether to download the image") - @RequestParam(required = false, defaultValue = "false") boolean download) { + @Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostnameAndPort, + @Parameter(description = "Whether to download the image") @RequestParam(required = false, defaultValue = "false") boolean download) { Tuple host = ServerUtils.getHostnameAndPort(hostnameAndPort); String hostname = host.getLeft(); int port = host.getRight();