diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/AvailablePluginResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/AvailablePluginResource.java index bbd9444f01..7528b43eb2 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/AvailablePluginResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/AvailablePluginResource.java @@ -104,7 +104,13 @@ public class AvailablePluginResource { ) @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"plugin:read\" privilege") - @ApiResponse(responseCode = "404", description = "not found") + @ApiResponse( + responseCode = "404", + description = "not found, no plugin with the specified name found", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchRootResource.java index 1a41508e51..b18be9207e 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchRootResource.java @@ -82,7 +82,13 @@ public class BranchRootResource { @ApiResponse(responseCode = "400", description = "branches not supported for given repository") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the branch") - @ApiResponse(responseCode = "404", description = "not found, no branch with the specified name for the repository available or repository not found") + @ApiResponse( + responseCode = "404", + description = "not found, no branch with the specified name for the repository available or repository found", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", @@ -122,7 +128,13 @@ public class BranchRootResource { ) @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the changeset") - @ApiResponse(responseCode = "404", description = "not found, no changesets available in the repository") + @ApiResponse( + responseCode = "404", + description = "not found, no changesets available in the repository", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", @@ -137,7 +149,7 @@ public class BranchRootResource { @DefaultValue("0") @QueryParam("page") int page, @DefaultValue("10") @QueryParam("pageSize") int pageSize) throws IOException { try (RepositoryService repositoryService = serviceFactory.create(new NamespaceAndName(namespace, name))) { - if (!branchExists(branchName, repositoryService)){ + if (!branchExists(branchName, repositoryService)) { throw notFound(entity(Branch.class, branchName).in(Repository.class, namespace + "/" + name)); } Repository repository = repositoryService.getRepository(); diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/DiffRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/DiffRootResource.java index 6124cab10b..a41bdb01a3 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/DiffRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/DiffRootResource.java @@ -59,7 +59,13 @@ public class DiffRootResource { @ApiResponse(responseCode = "400", description = "bad request") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the diff") - @ApiResponse(responseCode = "404", description = "not found, no revision with the specified param for the repository available or repository not found") + @ApiResponse( + responseCode = "404", + description = "not found, no revision with the specified param for the repository available or repository found", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", @@ -97,7 +103,13 @@ public class DiffRootResource { @ApiResponse(responseCode = "400", description = "bad request") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the diff") - @ApiResponse(responseCode = "404", description = "not found, no revision with the specified param for the repository available or repository not found") + @ApiResponse( + responseCode = "404", + description = "not found, no revision with the specified param for the repository available or repository not found", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupPermissionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupPermissionResource.java index b00719abbe..8e42ef43e3 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupPermissionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupPermissionResource.java @@ -50,7 +50,13 @@ public class GroupPermissionResource { )) @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the group") - @ApiResponse(responseCode = "404", description = "not found, no group with the specified id/name available") + @ApiResponse( + responseCode = "404", + description = "not found, no group with the specified id/name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", @@ -79,7 +85,13 @@ public class GroupPermissionResource { @ApiResponse(responseCode = "400", description = "invalid body") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current group does not have the correct privilege") - @ApiResponse(responseCode = "404", description = "not found, no group with the specified id/name available") + @ApiResponse( + responseCode = "404", + description = "not found, no group with the specified id/name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupResource.java index 0e54d6855d..2a209408db 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupResource.java @@ -56,7 +56,13 @@ public class GroupResource { ) @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user has no privileges to read the group") - @ApiResponse(responseCode = "404", description = "not found, no group with the specified id/name available") + @ApiResponse( + responseCode = "404", + description = "not found, no group with the specified id/name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", @@ -110,7 +116,13 @@ public class GroupResource { @ApiResponse(responseCode = "400", description = "invalid body, e.g. illegal change of id/group name") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"group\" privilege") - @ApiResponse(responseCode = "404", description = "not found, no group with the specified id/name available") + @ApiResponse( + responseCode = "404", + description = "not found, no group with the specified id/name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/InstalledPluginResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/InstalledPluginResource.java index d5c891c2df..a442c70f7e 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/InstalledPluginResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/InstalledPluginResource.java @@ -126,7 +126,13 @@ public class InstalledPluginResource { ) @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"plugin:read\" privilege") - @ApiResponse(responseCode = "404", description = "not found, plugin by given id could not be found") + @ApiResponse( + responseCode = "404", + description = "not found, plugin by given id could not be found", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryTypeResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryTypeResource.java index fa1c5b66d3..b04ce46d98 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryTypeResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryTypeResource.java @@ -45,7 +45,13 @@ public class RepositoryTypeResource { schema = @Schema(implementation = RepositoryTypeDto.class) ) ) - @ApiResponse(responseCode = "404", description = "not found, no repository type with the specified name available") + @ApiResponse( + responseCode = "404", + description = "not found, no repository type with the specified name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) @ApiResponse( responseCode = "500", description = "internal server error", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserPermissionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserPermissionResource.java index bf8ff4b3c1..5611b32aeb 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserPermissionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserPermissionResource.java @@ -87,15 +87,21 @@ public class UserPermissionResource { @ApiResponse(responseCode = "400", description = "invalid body") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the correct privilege") - @ApiResponse(responseCode = "404", description = "not found, no user with the specified id/name available") @ApiResponse( - responseCode = "500", - description = "internal server error", - content = @Content( - mediaType = VndMediaType.ERROR_TYPE, - schema = @Schema(implementation = ErrorDto.class) - ) - ) + responseCode = "404", + description = "not found, no user with the specified id/name available", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + )) + @ApiResponse( + responseCode = "500", + description = "internal server error", + content = @Content( + mediaType = VndMediaType.ERROR_TYPE, + schema = @Schema(implementation = ErrorDto.class) + ) + ) public Response overwritePermissions(@PathParam("id") String id, @Valid PermissionListDto newPermissions) { Collection permissionDescriptors = Arrays.stream(newPermissions.getPermissions()) .map(PermissionDescriptor::new)