Controller์ Swagger ์์ ์ ์งํํ๋ฉด ๋งค์ฐ ์ง์ ๋ถํด์ง๋ค.
๋ณด๋ค ๊น๋ํ๊ฒ ์์ฑํ ์ ์๋ ๋ฐฉ๋ฒ์ ์๋์ ๊ฐ์ด Docs ์ธํฐํ์ด์ค๋ฅผ ๋ง๋ค์ด์ ๋ถ๋ฆฌํด ์ฃผ๋ฉด ๋๋ค.
@RequiredArgsConstructor
@RequestMapping("/api/v1/coins")
@RestController
public class CoinController implements CoinControllerDocs {
private final CoinService coinService;
@GetMapping("/{coinId}")
public ResponseEntity<GetUpbitCoinResponseDto> get(@PathVariable Long coinId) {
GetUpbitCoinResponseDto responseDto = coinService.get(coinId);
return ResponseEntity.ok(responseDto);
}
@GetMapping
public ResponseEntity<ListUpbitCoinResponseDto> gets() {
ListUpbitCoinResponseDto responseDto = coinService.gets();
return ResponseEntity.ok(responseDto);
}
@GetMapping("/search")
public ResponseEntity<ListUpbitCoinResponseDto> search(@RequestParam String query) {
ListUpbitCoinResponseDto responseDto = coinService.search(query);
return ResponseEntity.ok(responseDto);
}
}
@Tag(name = "์ํธํํ", description = "์ํธํํ ๊ด๋ จ API")
public interface CoinControllerDocs {
@Operation(summary = "์ํธํํ ์ ๋ณด ์กฐํ ๊ธฐ๋ฅ", description = "์ํธํํ ์ ๋ณด ์กฐํ API")
ResponseEntity<GetUpbitCoinResponseDto> get(@PathVariable Long coinId);
@Operation(summary = "์ํธํํ ๋ชฉ๋ก ์กฐํ ๊ธฐ๋ฅ", description = "์ํธํํ ๋ชฉ๋ก ์กฐํ API")
ResponseEntity<ListUpbitCoinResponseDto> gets();
@Operation(summary = "์ํธํํ ๊ฒ์ ๊ธฐ๋ฅ", description = "์ํธํํ ๊ฒ์ API")
ResponseEntity<ListUpbitCoinResponseDto> search(@RequestParam String query);
}