From 5897863f7e371c8d4666355f39139b620626cbfd Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Tue, 3 Mar 2020 14:49:35 +0100 Subject: [PATCH] fix several openapi errors --- .../scm/api/v2/resources/GitConfigResource.java | 9 +++------ .../sonia/scm/api/v2/resources/HgConfigResource.java | 4 ++-- .../scm/api/v2/resources/SvnConfigResource.java | 4 ++-- .../scm/api/v2/resources/BranchRootResource.java | 10 +--------- .../api/v2/resources/GroupCollectionResource.java | 12 ++---------- .../v2/resources/RepositoryCollectionResource.java | 10 +--------- .../resources/RepositoryPermissionRootResource.java | 9 ++------- .../resources/RepositoryRoleCollectionResource.java | 10 +--------- .../scm/api/v2/resources/UserCollectionResource.java | 10 +--------- 9 files changed, 15 insertions(+), 63 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/api/v2/resources/GitConfigResource.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/api/v2/resources/GitConfigResource.java index 098396098f..a7f56ec15d 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/api/v2/resources/GitConfigResource.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/api/v2/resources/GitConfigResource.java @@ -51,7 +51,7 @@ public class GitConfigResource { @GET @Path("") @Produces(GitVndMediaType.GIT_CONFIG) - @Operation(summary = "Git configuration", description = "Returns the global git configuration.", tags = "Git") + @Operation(summary = "Git configuration", description = "Returns the global git configuration.", tags = "Git", operationId = "git_get_config") @ApiResponse( responseCode = "200", description = "success", @@ -91,11 +91,8 @@ public class GitConfigResource { @PUT @Path("") @Consumes(GitVndMediaType.GIT_CONFIG) - @Operation(summary = "Modify git configuration", description = "Modifies the global git configuration.", tags = "Git") - @ApiResponse( - responseCode = "204", - description = "update success" - ) + @Operation(summary = "Modify git configuration", description = "Modifies the global git configuration.", tags = "Git", operationId = "git_put_config") + @ApiResponse(responseCode = "204", description = "update success") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"configuration:write:git\" privilege") @ApiResponse( diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/api/v2/resources/HgConfigResource.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/api/v2/resources/HgConfigResource.java index be534f4345..8a9b5aac1e 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/api/v2/resources/HgConfigResource.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/api/v2/resources/HgConfigResource.java @@ -57,7 +57,7 @@ public class HgConfigResource { @GET @Path("") @Produces(HgVndMediaType.CONFIG) - @Operation(summary = "Hg configuration", description = "Returns the global mercurial configuration.", tags = "Mercurial") + @Operation(summary = "Hg configuration", description = "Returns the global mercurial configuration.", tags = "Mercurial", operationId = "hg_get_config") @ApiResponse( responseCode = "200", description = "success", @@ -97,7 +97,7 @@ public class HgConfigResource { @PUT @Path("") @Consumes(HgVndMediaType.CONFIG) - @Operation(summary = "Modify hg configuration", description = "Modifies the global mercurial configuration.", tags = "Mercurial") + @Operation(summary = "Modify hg configuration", description = "Modifies the global mercurial configuration.", tags = "Mercurial", operationId = "hg_put_config") @ApiResponse( responseCode = "204", description = "update success" diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/api/v2/resources/SvnConfigResource.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/api/v2/resources/SvnConfigResource.java index 9ff13ffb46..2e2963f076 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/api/v2/resources/SvnConfigResource.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/api/v2/resources/SvnConfigResource.java @@ -48,7 +48,7 @@ public class SvnConfigResource { @GET @Path("") @Produces(SvnVndMediaType.SVN_CONFIG) - @Operation(summary = "Svn configuration", description = "Returns the global subversion configuration.", tags = "Subversion") + @Operation(summary = "Svn configuration", description = "Returns the global subversion configuration.", tags = "Subversion", operationId = "svn_get_config") @ApiResponse( responseCode = "200", description = "success", @@ -88,7 +88,7 @@ public class SvnConfigResource { @PUT @Path("") @Consumes(SvnVndMediaType.SVN_CONFIG) - @Operation(summary = "Modify svn configuration", description = "Modifies the global subversion configuration.", tags = "Subversion") + @Operation(summary = "Modify svn configuration", description = "Modifies the global subversion configuration.", tags = "Subversion", operationId = "svn_put_config") @ApiResponse( responseCode = "204", description = "update success" 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 33c6fb0908..62725cb2e4 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 @@ -2,7 +2,6 @@ package sonia.scm.api.v2.resources; import com.google.common.base.Strings; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -180,14 +179,7 @@ public class BranchRootResource { @Path("") @Consumes(VndMediaType.BRANCH_REQUEST) @Operation(summary = "Create branch", description = "Creates a new branch.", tags = "Repository") - @ApiResponse( - responseCode = "201", - description = "create success", - headers = @Header( - name = "Location", - description = "uri to the created branch" - ) - ) + @ApiResponse(responseCode = "201", description = "create success") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"push\" privilege") @ApiResponse(responseCode = "409", description = "conflict, a branch with this name already exists") diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupCollectionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupCollectionResource.java index 455a82c4f9..62cbe83c33 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupCollectionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/GroupCollectionResource.java @@ -1,7 +1,6 @@ package sonia.scm.api.v2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -95,15 +94,8 @@ public class GroupCollectionResource { @POST @Path("") @Consumes(VndMediaType.GROUP) - @Operation(summary = "Create group", description = "Creates a new group.", tags = "Group") - @ApiResponse( - responseCode = "201", - description = "create success", - headers = @Header( - name = "Location", - description = "uri to the created group" - ) - ) + @Operation(summary = "Create group", description = "Creates a new group.", tags = "Group", operationId = "group_create") + @ApiResponse(responseCode = "201", description = "create success") @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 = "409", description = "conflict, a group with this name already exists") diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryCollectionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryCollectionResource.java index d7fd6a79a4..70dfa48074 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryCollectionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryCollectionResource.java @@ -1,7 +1,6 @@ package sonia.scm.api.v2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -104,14 +103,7 @@ public class RepositoryCollectionResource { @Path("") @Consumes(VndMediaType.REPOSITORY) @Operation(summary = "Create repository", description = "Creates a new repository.", tags = "Repository") - @ApiResponse( - responseCode = "201", - description = "create success", - headers = @Header( - name = "Location", - description = "uri to the created repository" - ) - ) + @ApiResponse(responseCode = "201", description = "create success") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"repository\" privilege") @ApiResponse(responseCode = "409", description = "conflict, a repository with this name already exists") diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryPermissionRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryPermissionRootResource.java index 1cebbba3c7..f0f8100add 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryPermissionRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryPermissionRootResource.java @@ -1,7 +1,6 @@ package sonia.scm.api.v2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -9,9 +8,9 @@ import lombok.extern.slf4j.Slf4j; import sonia.scm.AlreadyExistsException; import sonia.scm.NotFoundException; import sonia.scm.repository.NamespaceAndName; -import sonia.scm.repository.RepositoryPermission; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryManager; +import sonia.scm.repository.RepositoryPermission; import sonia.scm.repository.RepositoryPermissions; import sonia.scm.web.VndMediaType; @@ -68,11 +67,7 @@ public class RepositoryPermissionRootResource { @Path("") @Consumes(VndMediaType.REPOSITORY_PERMISSION) @Operation(summary = "Create repository-specific permission", description = "Adds a new permission to the user or group managed by the repository.", tags = {"Repository", "Permissions"}) - @ApiResponse( - responseCode = "201", - description = "creates", - headers = @Header(name = "Location", description = "uri of the created permission") - ) + @ApiResponse(responseCode = "201", description = "creates") @ApiResponse( responseCode = "404", description = "not found", diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryRoleCollectionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryRoleCollectionResource.java index a039b0cb35..5e58929308 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryRoleCollectionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryRoleCollectionResource.java @@ -1,7 +1,6 @@ package sonia.scm.api.v2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -91,14 +90,7 @@ public class RepositoryRoleCollectionResource { @Path("") @Consumes(VndMediaType.REPOSITORY_ROLE) @Operation(summary = "Create repository role", description = "Creates a new repository role.", tags = "Repository role") - @ApiResponse( - responseCode = "201", - description = "create success", - headers = @Header( - name = "Location", - description = "uri to the created repository role" - ) - ) + @ApiResponse(responseCode = "201", description = "create success") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"repositoryRole\" privilege") @ApiResponse(responseCode = "409", description = "conflict, a repository role with this name already exists") diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserCollectionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserCollectionResource.java index ef8b230f8a..0b153d87c6 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserCollectionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UserCollectionResource.java @@ -1,7 +1,6 @@ package sonia.scm.api.v2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -100,14 +99,7 @@ public class UserCollectionResource { @Path("") @Consumes(VndMediaType.USER) @Operation(summary = "Create user", description = "Creates a new user.", tags = "User") - @ApiResponse( - responseCode = "201", - description = "create success", - headers = @Header( - name = "Location", - description = "uri to the created user" - ) - ) + @ApiResponse(responseCode = "201", description = "create success") @ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials") @ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"user\" privilege") @ApiResponse(responseCode = "409", description = "conflict, a user with this name already exists")