Minor corrections to resources and dtos

This commit is contained in:
Florian Scholdei
2020-11-18 11:56:56 +01:00
committed by René Pfeuffer
parent 3384707517
commit ec87ccca9d
14 changed files with 65 additions and 22 deletions

View File

@@ -142,7 +142,7 @@ public class ApiKeyResource {
mediaType = VndMediaType.API_KEY,
schema = @Schema(implementation = CreateApiKeyDto.class),
examples = @ExampleObject(
name = "Create a new api key named readKey with READ permission role",
name = "Create a new api key named readKey with READ permission role.",
value = "{\n \"displayName\":\"readKey\",\n \"permissionRole\":\"READ\"\n}",
summary = "Create new api key"
)

View File

@@ -220,7 +220,7 @@ public class BranchRootResource {
mediaType = VndMediaType.BRANCH_REQUEST,
schema = @Schema(implementation = BranchRequestDto.class),
examples = @ExampleObject(
name = "Branch a new develop branch from main",
name = "Branch a new develop branch from main.",
value = "{\n \"parent\":\"main\",\n \"name\":\"develop\"\n}",
summary = "Create a branch"
)

View File

@@ -134,7 +134,7 @@ public class ConfigResource {
mediaType = VndMediaType.CONFIG,
schema = @Schema(implementation = UpdateConfigDto.class),
examples = @ExampleObject(
name = "Overwrites current configuration with this one",
name = "Overwrites current configuration with this one.",
value = "{\n \"realmDescription\":\"SONIA :: SCM-Manager\",\n \"dateFormat\":\"YYYY-MM-DD HH:mm:ss\",\n \"baseUrl\":\"http://localhost:8081/scm\",\n \"loginAttemptLimit\":-1,\n \"pluginUrl\":\"https://plugin-center-api.scm-manager.org/api/v1/plugins/{version}?os={os}&arch={arch}\",\n \"loginAttemptLimitTimeout\":500,\n \"namespaceStrategy\":\"CustomNamespaceStrategy\",\n \"loginInfoUrl\":\"https://login-info.scm-manager.org/api/v1/login-info\",\n \"releaseFeedUrl\":\"https://scm-manager.org/download/rss.xml\",\n \"mailDomainName\":\"scm-manager.local\"\n}",
summary = "Simple update configuration"
)

View File

@@ -116,7 +116,7 @@ public class MeResource {
mediaType = VndMediaType.PASSWORD_CHANGE,
schema = @Schema(implementation = PasswordChangeDto.class),
examples = @ExampleObject(
name = "Change password to a more difficult one",
name = "Change password to a more difficult one.",
value = "{ \"oldPassword\":\"scmadmin\",\n \"newPassword\":\"5cm4dm1n\"\n}",
summary = "Simple change password"
)

View File

@@ -98,9 +98,9 @@ public class NamespacePermissionResource {
requestBody = @RequestBody(
content = @Content(
mediaType = VndMediaType.REPOSITORY_PERMISSION,
schema = @Schema(implementation = PermissionListDto.class),
schema = @Schema(implementation = UpdatePermissionListDto.class),
examples = @ExampleObject(
name = "Add read permissions for repositories and pull requests to manager group",
name = "Add read permissions for repositories and pull requests to manager group.",
value = "{\n \"name\":\"manager\",\n \"verbs\":[\"read\",\"readPullRequest\"],\n \"groupPermission\":true\n}",
summary = "Add a permission"
)
@@ -244,9 +244,9 @@ public class NamespacePermissionResource {
requestBody = @RequestBody(
content = @Content(
mediaType = VndMediaType.REPOSITORY_PERMISSION,
schema = @Schema(implementation = PermissionListDto.class),
schema = @Schema(implementation = UpdatePermissionListDto.class),
examples = @ExampleObject(
name = "Update permissions of manager group",
name = "Update permissions of manager group.",
value = "{\n \"name\":\"manager\",\n \"verbs\":[\"read\",\"permissionRead\",\"readPullRequest\"],\n \"groupPermission\":true\n}",
summary = "Update a permission"
)

View File

@@ -171,9 +171,9 @@ public class RepositoryCollectionResource {
mediaType = VndMediaType.REPOSITORY,
schema = @Schema(implementation = CreateRepositoryDto.class),
examples = @ExampleObject(
name = "Create a new git repository named scm-manager in scmadmin namespace",
name = "Create a new git repository named scm-manager in scmadmin namespace.",
value = "{\n \"namespace\":\"scmadmin\",\n \"name\":\"scm-manager\",\n \"type\":\"git\"\n}",
summary = "Create a simple git repository"
summary = "Create a git repository"
)
)
)

View File

@@ -100,11 +100,11 @@ public class RepositoryPermissionRootResource {
requestBody = @RequestBody(
content = @Content(
mediaType = VndMediaType.REPOSITORY_PERMISSION,
schema = @Schema(implementation = PermissionListDto.class),
schema = @Schema(implementation = UpdatePermissionListDto.class),
examples = @ExampleObject(
name = "Add read permissions for repository and pull requests to manager group",
name = "Add read permissions for repository and pull requests to manager group.",
value = "{\n \"name\":\"manager\",\n \"verbs\":[\"read\",\"readPullRequest\"],\n \"groupPermission\":true\n}",
summary = "Add a permission"
summary = "Add permissions"
)
)
)
@@ -252,9 +252,9 @@ public class RepositoryPermissionRootResource {
requestBody = @RequestBody(
content = @Content(
mediaType = VndMediaType.REPOSITORY_PERMISSION,
schema = @Schema(implementation = PermissionListDto.class),
schema = @Schema(implementation = UpdatePermissionListDto.class),
examples = @ExampleObject(
name = "Update permissions of manager group",
name = "Update permissions of manager group.",
value = "{\n \"name\":\"manager\",\n \"verbs\":[\"read\",\"permissionRead\",\"readPullRequest\"],\n \"groupPermission\":true\n}",
summary = "Update a permission"
)

View File

@@ -33,7 +33,7 @@ import javax.validation.constraints.Pattern;
@Getter
@NoArgsConstructor
public class RepositoryRenameDto {
private String namespace;
@Pattern(regexp = ValidationUtil.REGEX_REPOSITORYNAME)
private String name;
private String namespace;
}

View File

@@ -162,7 +162,7 @@ public class RepositoryResource {
mediaType = VndMediaType.REPOSITORY,
schema = @Schema(implementation = UpdateRepositoryDto.class),
examples = @ExampleObject(
name = "Update repository description",
name = "Update repository description.",
value = "{\n \"namespace\":\"scmadmin\",\n \"name\":\"scm-manager\",\n \"description\":\"The easiest way to share and manage your Git, Mercurial and Subversion repositories.\",\n \"type\":\"git\",\n \"lastModified\":\"2020-06-05T14:42:49.000Z\"\n}",
summary = "Update a repository"
)

View File

@@ -125,7 +125,7 @@ public class RepositoryRoleCollectionResource {
mediaType = VndMediaType.REPOSITORY_ROLE,
schema = @Schema(implementation = CreateRepositoryRoleDto.class),
examples = @ExampleObject(
name = "Create repository role named hero with read and delete repository permission",
name = "Create repository role named hero with read and delete repository permission.",
value = "{\n \"name\":\"hero\",\n \"system\":false,\n \"verbs\":[\"read\",\"delete\"]\n}",
summary = "Add a repository role"
)

View File

@@ -139,7 +139,7 @@ public class RepositoryRoleResource {
mediaType = VndMediaType.REPOSITORY_ROLE,
schema = @Schema(implementation = UpdateRepositoryRoleDto.class),
examples = @ExampleObject(
name = "Update repository role named hero with this verbs",
name = "Update repository role named hero with this verbs.",
value = "{\n \"name\":\"hero\",\n \"system\":false,\n \"verbs\":[\"read\",\"pull\",\"write\",\"push\",\"delete\"],\n \"lastModified\":\"2020-06-05T14:42:49.000Z\"\n}",
summary = "Update a repository role"
)

View File

@@ -0,0 +1,43 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.api.v2.resources;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
/**
* This class is currently only used in the openapi scheme
*/
@Getter
@Setter
@NoArgsConstructor
public class UpdatePermissionListDto {
@NotNull
private String[] permissions;
}

View File

@@ -115,9 +115,9 @@ public class UserPermissionResource {
requestBody = @RequestBody(
content = @Content(
mediaType = VndMediaType.PERMISSION_COLLECTION,
schema = @Schema(implementation = PermissionListDto.class),
schema = @Schema(implementation = UpdatePermissionListDto.class),
examples = @ExampleObject(
name = "Add read permissions for all repositories and pull requests",
name = "Add read permissions for all repositories and pull requests.",
value = "{\n \"permissions\":[\"repository:read,pull:*\",\"repository:readPullRequest:*\"]\n}",
summary = "Simple update user permissions"
)

View File

@@ -194,7 +194,7 @@ public class UserResource {
mediaType = VndMediaType.PASSWORD_OVERWRITE,
schema = @Schema(implementation = PasswordOverwriteDto.class),
examples = @ExampleObject(
name = "Overwrites current password with a more difficult one",
name = "Overwrites current password with a more difficult one.",
value = "{ \"newPassword\":\"5cm4dm1n\"\n}",
summary = "Set new password"
)