Adding schema doc

This commit is contained in:
Martin Stockhammer 2021-01-14 23:01:06 +01:00
parent 095a901424
commit 1c3d770e30
22 changed files with 64 additions and 84 deletions

View File

@ -76,7 +76,7 @@ public class Application
this.description = description; this.description = description;
} }
@Schema(description = "May be a longer explanation, of the application purpose and its defined roles.") @Schema(name="long_description", description = "May be a longer explanation, of the application purpose and its defined roles.")
public String getLongDescription() public String getLongDescription()
{ {
return longDescription; return longDescription;

View File

@ -45,7 +45,7 @@ public class BaseGroupInfo implements Serializable
this.groupName = groupName; this.groupName = groupName;
} }
@Schema(description = "The name of the group") @Schema(name="group_name", description = "The name of the group")
public String getGroupName( ) public String getGroupName( )
{ {
return groupName; return groupName;

View File

@ -128,7 +128,7 @@ public class BaseRoleInfo implements Serializable
this.id = id; this.id = id;
} }
@Schema(description = "The model this role is derived from") @Schema(name="model_id", description = "The model this role is derived from")
public String getModelId( ) public String getModelId( )
{ {
return modelId; return modelId;
@ -150,7 +150,7 @@ public class BaseRoleInfo implements Serializable
this.resource = resource; this.resource = resource;
} }
@Schema(description = "True, if this is a instance of a role template") @Schema(name="template_instance", description = "True, if this is a instance of a role template")
public boolean isTemplateInstance( ) public boolean isTemplateInstance( )
{ {
return isTemplateInstance; return isTemplateInstance;
@ -223,7 +223,7 @@ public class BaseRoleInfo implements Serializable
return sb.toString( ); return sb.toString( );
} }
@Schema(description = "Application id, where this role belongs to. This is only filled by certain REST methods.") @Schema(name="application_id", description = "Application id, where this role belongs to. This is only filled by certain REST methods.")
public String getApplicationId( ) public String getApplicationId( )
{ {
return applicationId; return applicationId;

View File

@ -60,7 +60,7 @@ public class Group implements Serializable
this.name = name; this.name = name;
} }
@Schema(description = "The unique name of the group. Depends on the backend repository, e.g. the LDAP DN.") @Schema(name="unique_name", description = "The unique name of the group. Depends on the backend repository, e.g. the LDAP DN.")
public String getUniqueName( ) public String getUniqueName( )
{ {
return uniqueName; return uniqueName;
@ -82,7 +82,7 @@ public class Group implements Serializable
this.description = description; this.description = description;
} }
@Schema(description = "The list of members. The format of the member strings depends on the backend repository, e.g. for LDAP these may be the member DNs") @Schema(name="member_list", description = "The list of members. The format of the member strings depends on the backend repository, e.g. for LDAP these may be the member DNs")
public List<String> getMemberList( ) public List<String> getMemberList( )
{ {
return memberList; return memberList;

View File

@ -49,7 +49,7 @@ public class GroupMapping implements Serializable
this.roles = roles; this.roles = roles;
} }
@Schema(description = "The name of the mapped group") @Schema(name="group_name", description = "The name of the mapped group")
public String getGroupName( ) public String getGroupName( )
{ {
return groupName; return groupName;
@ -60,7 +60,7 @@ public class GroupMapping implements Serializable
this.groupName = groupName; this.groupName = groupName;
} }
@Schema(description = "The unique name of the mapped group. Dependent on the used repository backend.") @Schema(name="unique_group_name", description = "The unique name of the mapped group. Dependent on the used repository backend.")
public String getUniqueGroupName( ) public String getUniqueGroupName( )
{ {
return uniqueGroupName; return uniqueGroupName;
@ -71,7 +71,7 @@ public class GroupMapping implements Serializable
this.uniqueGroupName = uniqueGroupName; this.uniqueGroupName = uniqueGroupName;
} }
@Schema(description = "The list of role names mapped to this group") @Schema(description = "The list of role ids mapped to this group")
public List<String> getRoles( ) public List<String> getRoles( )
{ {
return roles; return roles;

View File

@ -99,6 +99,7 @@ public class Operation
return sb.toString(); return sb.toString();
} }
@Schema(name="description_key",description = "The language key for the description")
public String getDescriptionKey( ) public String getDescriptionKey( )
{ {
return descriptionKey; return descriptionKey;

View File

@ -38,7 +38,7 @@ public class PasswordChange implements Serializable
String newPassword; String newPassword;
String newPasswordConfirmation; String newPasswordConfirmation;
@Schema(description = "The current password of the logged in user, or a initial registration key") @Schema(name="current_password", description = "The current password of the logged in user, or a initial registration key")
public String getCurrentPassword( ) public String getCurrentPassword( )
{ {
return currentPassword; return currentPassword;
@ -50,7 +50,7 @@ public class PasswordChange implements Serializable
} }
@Schema(description = "The User Id for the user to change the password. Must match the current logged in user.") @Schema(name="user_id", description = "The User Id for the user to change the password. Must match the current logged in user.")
public String getUserId( ) public String getUserId( )
{ {
return userId; return userId;
@ -61,7 +61,7 @@ public class PasswordChange implements Serializable
this.userId = userId; this.userId = userId;
} }
@Schema(description = "The new password to set") @Schema(name="new_password", description = "The new password to set")
public String getNewPassword( ) public String getNewPassword( )
{ {
return newPassword; return newPassword;
@ -72,7 +72,7 @@ public class PasswordChange implements Serializable
this.newPassword = newPassword; this.newPassword = newPassword;
} }
@Schema(description = "The new password to set as confirmation that it is typed correctly") @Schema(name="new_password_confirmation", description = "The new password to set as confirmation that it is typed correctly")
public String getNewPasswordConfirmation( ) public String getNewPasswordConfirmation( )
{ {
return newPasswordConfirmation; return newPasswordConfirmation;

View File

@ -1,50 +0,0 @@
package org.apache.archiva.redback.rest.api.model.v2;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement( name="passwordStatus" )
public class PasswordStatus
{
boolean changeRequired = false;
public PasswordStatus( )
{
}
public PasswordStatus( boolean changeRequired )
{
this.changeRequired = changeRequired;
}
public boolean isChangeRequired( )
{
return changeRequired;
}
public void setChangeRequired( boolean changeRequired )
{
this.changeRequired = changeRequired;
}
}

View File

@ -111,6 +111,7 @@ public class Permission
return sb.toString(); return sb.toString();
} }
@Schema(name="description_key",description = "The language key for the description")
public String getDescriptionKey( ) public String getDescriptionKey( )
{ {
return descriptionKey; return descriptionKey;

View File

@ -53,7 +53,7 @@ public class PingResult
this.success = success; this.success = success;
} }
@Schema( description = "The time, when the request arrived on the server" ) @Schema( name="request_time", description = "The time, when the request arrived on the server" )
public OffsetDateTime getRequestTime( ) public OffsetDateTime getRequestTime( )
{ {
return requestTime; return requestTime;

View File

@ -18,6 +18,8 @@ package org.apache.archiva.redback.rest.api.model.v2;
* under the License. * under the License.
*/ */
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable; import java.io.Serializable;
@ -43,6 +45,7 @@ public class RegistrationKey
this.emailValidationRequired = emailValidationRequired; this.emailValidationRequired = emailValidationRequired;
} }
@Schema(description = "The key sent after registration, which is used to verify")
public String getKey() public String getKey()
{ {
return key; return key;
@ -53,6 +56,7 @@ public class RegistrationKey
this.key = key; this.key = key;
} }
@Schema(name="email_validation_required",description = "If true, email validation is required for registration.")
public boolean isEmailValidationRequired( ) public boolean isEmailValidationRequired( )
{ {
return emailValidationRequired; return emailValidationRequired;

View File

@ -82,7 +82,7 @@ public class RoleInfo extends BaseRoleInfo
return super.getChildren( ); return super.getChildren( );
} }
@Schema( description = "List of names of children roles") @Schema( name="child_role_ids", description = "List of names of children roles")
public List<String> getChildRoleIds() public List<String> getChildRoleIds()
{ {
return childRoleIds; return childRoleIds;
@ -104,7 +104,7 @@ public class RoleInfo extends BaseRoleInfo
this.permissions = permissions; this.permissions = permissions;
} }
@Schema(description = "List of names of roles that are parents of this role.") @Schema(name="parent_role_ids", description = "List of names of roles that are parents of this role.")
public List<String> getParentRoleIds() public List<String> getParentRoleIds()
{ {
return parentRoleIds; return parentRoleIds;

View File

@ -83,7 +83,7 @@ public class RoleTemplate implements Serializable
this.description = description; this.description = description;
} }
@Schema(description = "Identifier of the application this template is part of") @Schema(name="application_id", description = "Identifier of the application this template is part of")
public String getApplicationId( ) public String getApplicationId( )
{ {
return applicationId; return applicationId;

View File

@ -36,7 +36,7 @@ public class RoleTree implements Serializable
Map<String, Application> applications; Map<String, Application> applications;
List<BaseRoleInfo> rootRoles; List<BaseRoleInfo> rootRoles;
@Schema(description = "The user id for which the assigned flags are set on the roles.") @Schema(name="user_id", description = "The user id for which the assigned flags are set on the roles.")
public String getUserId( ) public String getUserId( )
{ {
return userId; return userId;
@ -59,7 +59,7 @@ public class RoleTree implements Serializable
} }
@Schema(description = "The list of roles directly assigned to this application. Roles may contain children roles.") @Schema(name="root_roles", description = "The list of roles directly assigned to this application. Roles may contain children roles.")
public List<BaseRoleInfo> getRootRoles( ) public List<BaseRoleInfo> getRootRoles( )
{ {
return rootRoles; return rootRoles;

View File

@ -19,6 +19,8 @@ package org.apache.archiva.redback.rest.api.model.v2;
* under the License. * under the License.
*/ */
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/** /**
@ -33,6 +35,7 @@ public class SelfUserData
private String password; private String password;
private String currentPassword; private String currentPassword;
@Schema(name="email",description = "The email of the user.")
public String getEmail( ) public String getEmail( )
{ {
return email; return email;
@ -43,6 +46,7 @@ public class SelfUserData
this.email = email; this.email = email;
} }
@Schema(name="full_name", description = "The full or display name of the user.")
public String getFullName( ) public String getFullName( )
{ {
return fullName; return fullName;
@ -53,6 +57,7 @@ public class SelfUserData
this.fullName = fullName; this.fullName = fullName;
} }
@Schema(description = "New user password")
public String getPassword( ) public String getPassword( )
{ {
return password; return password;
@ -63,6 +68,7 @@ public class SelfUserData
this.password = password; this.password = password;
} }
@Schema(name="current_password",description = "The current user password.")
public String getCurrentPassword( ) public String getCurrentPassword( )
{ {
return currentPassword; return currentPassword;

View File

@ -18,6 +18,7 @@ package org.apache.archiva.redback.rest.api.model.v2;
* under the License. * under the License.
*/ */
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.archiva.redback.keys.AuthenticationKey; import org.apache.archiva.redback.keys.AuthenticationKey;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -76,6 +77,7 @@ public class Token
return token; return token;
} }
@Schema(description = "The key stored in this token.")
public String getKey( ) public String getKey( )
{ {
return key; return key;
@ -86,6 +88,7 @@ public class Token
this.key = key; this.key = key;
} }
@Schema(description = "Time, when the token was created")
public OffsetDateTime getCreated( ) public OffsetDateTime getCreated( )
{ {
return created; return created;
@ -100,6 +103,8 @@ public class Token
{ {
this.created = created; this.created = created;
} }
@Schema(description = "Time, when the token expires.")
public OffsetDateTime getExpires( ) public OffsetDateTime getExpires( )
{ {
return expires; return expires;
@ -115,6 +120,7 @@ public class Token
this.expires = expires; this.expires = expires;
} }
@Schema(description = "The principal, this token identifies")
public String getPrincipal( ) public String getPrincipal( )
{ {
return principal; return principal;
@ -125,6 +131,7 @@ public class Token
this.principal = principal; this.principal = principal;
} }
@Schema(description = "The purpose of this token")
public String getPurpose( ) public String getPurpose( )
{ {
return purpose; return purpose;

View File

@ -47,7 +47,7 @@ public class TokenRefreshRequest implements Serializable
} }
@XmlElement( name = "grant_type", required = true) @XmlElement( name = "grant_type", required = true)
@Schema(description = "The grant type for requesting the token. 'refresh_token' for token refresh") @Schema(name="grant_type", description = "The grant type for requesting the token. 'refresh_token' for token refresh")
public GrantType getGrantType( ) public GrantType getGrantType( )
{ {
return grantType; return grantType;
@ -59,7 +59,7 @@ public class TokenRefreshRequest implements Serializable
} }
@XmlElement( name = "refresh_token" ) @XmlElement( name = "refresh_token" )
@Schema(description = "The refresh token that is validated before generating the new access token") @Schema(name="refresh_token", description = "The refresh token that is validated before generating the new access token")
public String getRefreshToken( ) public String getRefreshToken( )
{ {
return refreshToken; return refreshToken;

View File

@ -138,7 +138,7 @@ public class User
this.userId = userId; this.userId = userId;
} }
@Schema( description = "The full name of the user" ) @Schema( name="full_name", description = "The full name of the user" )
public String getFullName( ) public String getFullName( )
{ {
return fullName; return fullName;
@ -193,7 +193,7 @@ public class User
this.password = password; this.password = password;
} }
@Schema(description = "True, if user has to change password") @Schema(name="password_change_required", description = "True, if user has to change password")
public boolean isPasswordChangeRequired() public boolean isPasswordChangeRequired()
{ {
return passwordChangeRequired; return passwordChangeRequired;
@ -204,6 +204,7 @@ public class User
this.passwordChangeRequired = passwordChangeRequired; this.passwordChangeRequired = passwordChangeRequired;
} }
@Schema(name="confirm_password",description = "The password confirmation, must be identical to the password.")
public String getConfirmPassword() public String getConfirmPassword()
{ {
return confirmPassword; return confirmPassword;
@ -214,6 +215,7 @@ public class User
this.confirmPassword = confirmPassword; this.confirmPassword = confirmPassword;
} }
@Schema(name="timestamp_account_creation",description = "The time, when the account was created")
public OffsetDateTime getTimestampAccountCreation() public OffsetDateTime getTimestampAccountCreation()
{ {
return timestampAccountCreation; return timestampAccountCreation;
@ -229,6 +231,7 @@ public class User
this.timestampAccountCreation = OffsetDateTime.ofInstant( timestampAccountCreation, ZoneId.systemDefault() ); this.timestampAccountCreation = OffsetDateTime.ofInstant( timestampAccountCreation, ZoneId.systemDefault() );
} }
@Schema(name="timestamp_last_login",description = "The time of the last user login (password based login).")
public OffsetDateTime getTimestampLastLogin() public OffsetDateTime getTimestampLastLogin()
{ {
return timestampLastLogin; return timestampLastLogin;
@ -244,6 +247,7 @@ public class User
this.timestampLastLogin = OffsetDateTime.ofInstant( timestampLastLogin, ZoneId.systemDefault( ) ); this.timestampLastLogin = OffsetDateTime.ofInstant( timestampLastLogin, ZoneId.systemDefault( ) );
} }
@Schema(name="timestamp_last_password_change",description = "The time of the last password change of this account.")
public OffsetDateTime getTimestampLastPasswordChange() public OffsetDateTime getTimestampLastPasswordChange()
{ {
return timestampLastPasswordChange; return timestampLastPasswordChange;
@ -259,6 +263,7 @@ public class User
this.timestampLastPasswordChange = OffsetDateTime.ofInstant( timestampLastPasswordChange, ZoneId.systemDefault() ); this.timestampLastPasswordChange = OffsetDateTime.ofInstant( timestampLastPasswordChange, ZoneId.systemDefault() );
} }
@Schema(name="current_password",description = "The current password")
public String getCurrentPassword() public String getCurrentPassword()
{ {
return currentPassword; return currentPassword;
@ -269,6 +274,7 @@ public class User
this.currentPassword = currentPassword; this.currentPassword = currentPassword;
} }
@Schema(name="assigned_roles",description = "List of role ids assigned to this user")
public List<String> getAssignedRoles() public List<String> getAssignedRoles()
{ {
return assignedRoles; return assignedRoles;
@ -279,6 +285,7 @@ public class User
this.assignedRoles = assignedRoles; this.assignedRoles = assignedRoles;
} }
@Schema(name="validation_token",description = "The token for request validation.")
public String getValidationToken() { public String getValidationToken() {
return validationToken; return validationToken;
} }

View File

@ -120,7 +120,7 @@ public class UserInfo extends BaseUserInfo
} }
@Schema( description = "The full name of the user" ) @Schema( name="full_name", description = "The full name of the user" )
public String getFullName( ) public String getFullName( )
{ {
return fullName; return fullName;
@ -164,7 +164,7 @@ public class UserInfo extends BaseUserInfo
this.locked = isLocked; this.locked = isLocked;
} }
@Schema( description = "True, if user has to change his password" ) @Schema( name="password_change_required", description = "True, if user has to change his password" )
public boolean isPasswordChangeRequired( ) public boolean isPasswordChangeRequired( )
{ {
return passwordChangeRequired; return passwordChangeRequired;
@ -186,7 +186,7 @@ public class UserInfo extends BaseUserInfo
this.permanent = permanent; this.permanent = permanent;
} }
@Schema(description = "The date and time, when the account was first created.") @Schema(name="timestamp_account_creation", description = "The date and time, when the account was first created.")
public OffsetDateTime getTimestampAccountCreation() public OffsetDateTime getTimestampAccountCreation()
{ {
return timestampAccountCreation; return timestampAccountCreation;
@ -202,7 +202,7 @@ public class UserInfo extends BaseUserInfo
this.timestampAccountCreation = OffsetDateTime.ofInstant( timestampAccountCreation, ZoneId.systemDefault() ); this.timestampAccountCreation = OffsetDateTime.ofInstant( timestampAccountCreation, ZoneId.systemDefault() );
} }
@Schema(description = "Date and time of the last successful login") @Schema(name="timestamp_last_login", description = "Date and time of the last successful login")
public OffsetDateTime getTimestampLastLogin() public OffsetDateTime getTimestampLastLogin()
{ {
return timestampLastLogin; return timestampLastLogin;
@ -218,7 +218,7 @@ public class UserInfo extends BaseUserInfo
this.timestampLastLogin = OffsetDateTime.ofInstant( timestampLastLogin, ZoneId.systemDefault( ) ); this.timestampLastLogin = OffsetDateTime.ofInstant( timestampLastLogin, ZoneId.systemDefault( ) );
} }
@Schema(description = "Date and time of the last password change") @Schema(name="timestamp_last_password_change", description = "Date and time of the last password change")
public OffsetDateTime getTimestampLastPasswordChange() public OffsetDateTime getTimestampLastPasswordChange()
{ {
return timestampLastPasswordChange; return timestampLastPasswordChange;
@ -234,7 +234,7 @@ public class UserInfo extends BaseUserInfo
this.timestampLastPasswordChange = OffsetDateTime.ofInstant( timestampLastPasswordChange, ZoneId.systemDefault() ); this.timestampLastPasswordChange = OffsetDateTime.ofInstant( timestampLastPasswordChange, ZoneId.systemDefault() );
} }
@Schema(description = "True, if this is user has readonly access") @Schema(name="read_only", description = "True, if this is user has readonly access")
public boolean isReadOnly() public boolean isReadOnly()
{ {
return readOnly; return readOnly;
@ -245,7 +245,7 @@ public class UserInfo extends BaseUserInfo
this.readOnly = readOnly; this.readOnly = readOnly;
} }
@Schema( description = "Id of the usermanager, where this user is registered") @Schema( name="user_manager_id", description = "Id of the usermanager, where this user is registered")
public String getUserManagerId() public String getUserManagerId()
{ {
return userManagerId; return userManagerId;
@ -256,7 +256,7 @@ public class UserInfo extends BaseUserInfo
this.userManagerId = userManagerId; this.userManagerId = userManagerId;
} }
@Schema( description = "Current validation token of this user") @Schema( name="validation_token", description = "Current validation token of this user")
public String getValidationToken() { public String getValidationToken() {
return validationToken; return validationToken;
} }

View File

@ -18,6 +18,8 @@ package org.apache.archiva.redback.rest.api.model.v2;
* under the License. * under the License.
*/ */
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable; import java.io.Serializable;
@ -26,6 +28,7 @@ import java.io.Serializable;
* @since 2.0 * @since 2.0
*/ */
@XmlRootElement( name = "userRegistrationRequest" ) @XmlRootElement( name = "userRegistrationRequest" )
@Schema(name="UserRegistrationRequest",description = "Registration request for a new user.")
public class UserRegistrationRequest public class UserRegistrationRequest
implements Serializable implements Serializable
{ {
@ -45,6 +48,7 @@ public class UserRegistrationRequest
this.applicationUrl = applicationUrl; this.applicationUrl = applicationUrl;
} }
@Schema(name="user", description = "Information about the new user that wants to be registered.")
public User getUser() public User getUser()
{ {
return user; return user;
@ -55,6 +59,7 @@ public class UserRegistrationRequest
this.user = user; this.user = user;
} }
@Schema(name="application_url",description = "The URL of the application, used to verify the request.")
public String getApplicationUrl() public String getApplicationUrl()
{ {
return applicationUrl; return applicationUrl;

View File

@ -51,7 +51,7 @@ public class VerificationStatus
this.success = success; this.success = success;
} }
@Schema(name="accessToken", description = "The access token that is used for registration") @Schema(name="access_token", description = "The access token that is used for registration")
public String getAccessToken( ) public String getAccessToken( )
{ {
return accessToken; return accessToken;

View File

@ -241,7 +241,6 @@ public class BaseRedbackService
{ {
Predicate<User> filter = USER_QUERY_HELPER.getQueryFilter( q ); Predicate<User> filter = USER_QUERY_HELPER.getQueryFilter( q );
long size = rawUsers.stream( ).filter( filter ).count( ); long size = rawUsers.stream( ).filter( filter ).count( );
System.out.println( "Total " + size );
List<UserInfo> users = rawUsers.stream( ) List<UserInfo> users = rawUsers.stream( )
.filter( filter ) .filter( filter )
.sorted( USER_QUERY_HELPER.getComparator( orderBy, ascending ) ).skip( offset ).limit( limit ) .sorted( USER_QUERY_HELPER.getComparator( orderBy, ascending ) ).skip( offset ).limit( limit )