Skip to content

Commit 6cec770

Browse files
committed
fix: return type in openapi for mappings that return strings (closes #1394)
1 parent af81fc2 commit 6cec770

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

backend/src/main/java/io/papermc/hangar/controller/api/v1/interfaces/IApiKeysController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface IApiKeysController {
3232
tags = "API Keys"
3333
)
3434
@ApiResponses({
35-
@ApiResponse(responseCode = "201", description = "Key created", content = @Content(schema = @Schema(implementation = String.class))),
35+
@ApiResponse(responseCode = "201", description = "Key created", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE, schema = @Schema(type = "string"))),
3636
@ApiResponse(responseCode = "401", description = "Api session missing, invalid or expired"),
3737
@ApiResponse(responseCode = "403", description = "Not enough permissions to use this endpoint")})
3838
@PostMapping(path = "/keys", produces = MediaType.TEXT_PLAIN_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)

backend/src/main/java/io/papermc/hangar/controller/api/v1/interfaces/IPagesController.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import io.papermc.hangar.model.internal.api.requests.StringContent;
55
import io.swagger.v3.oas.annotations.Operation;
66
import io.swagger.v3.oas.annotations.Parameter;
7+
import io.swagger.v3.oas.annotations.media.Content;
8+
import io.swagger.v3.oas.annotations.media.Schema;
79
import io.swagger.v3.oas.annotations.responses.ApiResponse;
810
import io.swagger.v3.oas.annotations.responses.ApiResponses;
911
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -27,7 +29,7 @@ public interface IPagesController {
2729
tags = "Pages"
2830
)
2931
@ApiResponses({
30-
@ApiResponse(responseCode = "200", description = "Ok"),
32+
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE, schema = @Schema(type = "string"))),
3133
@ApiResponse(responseCode = "401", description = "Api session missing, invalid or expired"),
3234
@ApiResponse(responseCode = "403", description = "Not enough permissions to use this endpoint")
3335
})
@@ -48,7 +50,7 @@ default String getMainPage(@Parameter(description = "The author of the project t
4850
tags = "Pages"
4951
)
5052
@ApiResponses({
51-
@ApiResponse(responseCode = "200", description = "Ok"),
53+
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE, schema = @Schema(type = "string"))),
5254
@ApiResponse(responseCode = "401", description = "Api session missing, invalid or expired"),
5355
@ApiResponse(responseCode = "403", description = "Not enough permissions to use this endpoint")
5456
})

backend/src/main/java/io/papermc/hangar/controller/api/v1/interfaces/IVersionsController.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import io.swagger.v3.oas.annotations.Parameter;
1212
import io.swagger.v3.oas.annotations.media.Content;
1313
import io.swagger.v3.oas.annotations.media.Encoding;
14+
import io.swagger.v3.oas.annotations.media.Schema;
1415
import io.swagger.v3.oas.annotations.parameters.RequestBody;
1516
import io.swagger.v3.oas.annotations.responses.ApiResponse;
1617
import io.swagger.v3.oas.annotations.responses.ApiResponses;
@@ -124,7 +125,7 @@ default PaginatedResult<Version> getVersions(@Parameter(description = "The autho
124125
tags = "Versions"
125126
)
126127
@ApiResponses({
127-
@ApiResponse(responseCode = "200", description = "Ok"),
128+
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE, schema = @Schema(type = "string"))),
128129
@ApiResponse(responseCode = "401", description = "Api session missing, invalid or expired"),
129130
@ApiResponse(responseCode = "403", description = "Not enough permissions to use this endpoint")
130131
})
@@ -146,7 +147,7 @@ default String getLatestReleaseVersion(@Parameter(description = "The author of t
146147
tags = "Versions"
147148
)
148149
@ApiResponses({
149-
@ApiResponse(responseCode = "200", description = "Ok"),
150+
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE, schema = @Schema(type = "string"))),
150151
@ApiResponse(responseCode = "401", description = "Api session missing, invalid or expired"),
151152
@ApiResponse(responseCode = "403", description = "Not enough permissions to use this endpoint")
152153
})

0 commit comments

Comments
 (0)