Skip to content

Commit e8b356a

Browse files
fix(controller): Improve operationId usage to avoid weird method generation (#26)
Co-authored-by: theEvilReaper <theEvilReaper@users.noreply.github.com>
1 parent d566dec commit e8b356a

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

backend/src/main/java/net/onelitefeather/otis/controller/OtisRequestsController.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public OtisRequestsController(OtisPlayerRepository repository) {
3535

3636
@Operation(
3737
summary = "Add a new Otis player",
38+
operationId = "addPlayer",
3839
description = "This endpoint allows you to add a new Otis player to the database.",
3940
tags = {"Player"}
4041
)
@@ -66,6 +67,7 @@ public HttpResponse<OtisPlayerDTO> add(@Valid OtisPlayerDTO playerDTO) {
6667

6768
@Operation(
6869
summary = "Get Otis player by ID",
70+
operationId = "getPlayerById",
6971
description = "This endpoint retrieves an Otis player by their UUID.",
7072
tags = {"Player"}
7173
)
@@ -97,6 +99,7 @@ public HttpResponse<OtisPlayerDTO> getById(@Valid UUID owner) {
9799

98100
@Operation(
99101
summary = "Get Otis player by name",
102+
operationId = "getPlayerByName",
100103
description = "This endpoint retrieves an Otis player by their name.",
101104
tags = {"Player"}
102105
)
@@ -128,6 +131,7 @@ public HttpResponse<OtisPlayerDTO> getByString(@Valid String owner) {
128131

129132
@Operation(
130133
summary = "Update an existing Otis player",
134+
operationId = "updatePlayer",
131135
description = "This endpoint allows you to update an existing Otis player in the database.",
132136
tags = {"Player"}
133137
)
@@ -160,6 +164,7 @@ public HttpResponse<OtisPlayerDTO> update(@Valid UUID owner, @Valid OtisPlayerDT
160164

161165
@Operation(
162166
summary = "Delete an Otis player",
167+
operationId = "deletePlayer",
163168
description = "This endpoint allows you to delete an Otis player from the database.",
164169
tags = {"Player"}
165170
)
@@ -198,6 +203,7 @@ public HttpResponse<OtisPlayerDTO> delete(@Valid UUID owner) {
198203
*/
199204
@Operation(
200205
summary = "Get all Otis players",
206+
operationId = "getAllPlayers",
201207
description = "This endpoint retrieves all Otis players from the database.",
202208
tags = {"Player"}
203209
)
@@ -217,7 +223,7 @@ public HttpResponse<OtisPlayerDTO> delete(@Valid UUID owner) {
217223
schema = @Schema(implementation = String.class)
218224
)
219225
)
220-
@Get(uris = {"/getAll", "/all"})
226+
@Get(uris = {"/all"})
221227
public HttpResponse<Iterable<OtisPlayerDTO>> getAll(Pageable pageable) {
222228
Page<OtisPlayer> entities = this.repository.findAll(pageable);
223229
if (entities.isEmpty()) {

backend/src/main/java/net/onelitefeather/otis/controller/OtisSearchController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public OtisSearchController(OtisPlayerRepository playerRepository) {
3535

3636
@Operation(
3737
summary = "Search for a player by their ID",
38+
operationId = "searchById",
3839
description = "Returns the player information if found, otherwise returns 404 Not Found.",
3940
tags = {"Player", "Search"}
4041
)
@@ -68,6 +69,7 @@ public HttpResponse<OtisPlayerDTO> searchById(@Valid UUID id) {
6869

6970
@Operation(
7071
summary = "Search for a player by their name",
72+
operationId = "searchByName",
7173
description = "Returns the player information if found, otherwise returns 404 Not Found.",
7274
tags = {"Player", "Search"}
7375
)

0 commit comments

Comments
 (0)