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;
}
@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()
{
return longDescription;

View File

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

View File

@ -128,7 +128,7 @@ public class BaseRoleInfo implements Serializable
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( )
{
return modelId;
@ -150,7 +150,7 @@ public class BaseRoleInfo implements Serializable
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( )
{
return isTemplateInstance;
@ -223,7 +223,7 @@ public class BaseRoleInfo implements Serializable
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( )
{
return applicationId;

View File

@ -60,7 +60,7 @@ public class Group implements Serializable
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( )
{
return uniqueName;
@ -82,7 +82,7 @@ public class Group implements Serializable
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( )
{
return memberList;

View File

@ -49,7 +49,7 @@ public class GroupMapping implements Serializable
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( )
{
return groupName;
@ -60,7 +60,7 @@ public class GroupMapping implements Serializable
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( )
{
return uniqueGroupName;
@ -71,7 +71,7 @@ public class GroupMapping implements Serializable
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( )
{
return roles;

View File

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

View File

@ -38,7 +38,7 @@ public class PasswordChange implements Serializable
String newPassword;
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( )
{
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( )
{
return userId;
@ -61,7 +61,7 @@ public class PasswordChange implements Serializable
this.userId = userId;
}
@Schema(description = "The new password to set")
@Schema(name="new_password", description = "The new password to set")
public String getNewPassword( )
{
return newPassword;
@ -72,7 +72,7 @@ public class PasswordChange implements Serializable
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( )
{
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();
}
@Schema(name="description_key",description = "The language key for the description")
public String getDescriptionKey( )
{
return descriptionKey;

View File

@ -53,7 +53,7 @@ public class PingResult
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( )
{
return requestTime;

View File

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

View File

@ -82,7 +82,7 @@ public class RoleInfo extends BaseRoleInfo
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()
{
return childRoleIds;
@ -104,7 +104,7 @@ public class RoleInfo extends BaseRoleInfo
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()
{
return parentRoleIds;

View File

@ -83,7 +83,7 @@ public class RoleTemplate implements Serializable
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( )
{
return applicationId;

View File

@ -36,7 +36,7 @@ public class RoleTree implements Serializable
Map<String, Application> applications;
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( )
{
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( )
{
return rootRoles;

View File

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

View File

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

View File

@ -47,7 +47,7 @@ public class TokenRefreshRequest implements Serializable
}
@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( )
{
return grantType;
@ -59,7 +59,7 @@ public class TokenRefreshRequest implements Serializable
}
@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( )
{
return refreshToken;

View File

@ -138,7 +138,7 @@ public class User
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( )
{
return fullName;
@ -193,7 +193,7 @@ public class User
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()
{
return passwordChangeRequired;
@ -204,6 +204,7 @@ public class User
this.passwordChangeRequired = passwordChangeRequired;
}
@Schema(name="confirm_password",description = "The password confirmation, must be identical to the password.")
public String getConfirmPassword()
{
return confirmPassword;
@ -214,6 +215,7 @@ public class User
this.confirmPassword = confirmPassword;
}
@Schema(name="timestamp_account_creation",description = "The time, when the account was created")
public OffsetDateTime getTimestampAccountCreation()
{
return timestampAccountCreation;
@ -229,6 +231,7 @@ public class User
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()
{
return timestampLastLogin;
@ -244,6 +247,7 @@ public class User
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()
{
return timestampLastPasswordChange;
@ -259,6 +263,7 @@ public class User
this.timestampLastPasswordChange = OffsetDateTime.ofInstant( timestampLastPasswordChange, ZoneId.systemDefault() );
}
@Schema(name="current_password",description = "The current password")
public String getCurrentPassword()
{
return currentPassword;
@ -269,6 +274,7 @@ public class User
this.currentPassword = currentPassword;
}
@Schema(name="assigned_roles",description = "List of role ids assigned to this user")
public List<String> getAssignedRoles()
{
return assignedRoles;
@ -279,6 +285,7 @@ public class User
this.assignedRoles = assignedRoles;
}
@Schema(name="validation_token",description = "The token for request validation.")
public String getValidationToken() {
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( )
{
return fullName;
@ -164,7 +164,7 @@ public class UserInfo extends BaseUserInfo
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( )
{
return passwordChangeRequired;
@ -186,7 +186,7 @@ public class UserInfo extends BaseUserInfo
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()
{
return timestampAccountCreation;
@ -202,7 +202,7 @@ public class UserInfo extends BaseUserInfo
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()
{
return timestampLastLogin;
@ -218,7 +218,7 @@ public class UserInfo extends BaseUserInfo
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()
{
return timestampLastPasswordChange;
@ -234,7 +234,7 @@ public class UserInfo extends BaseUserInfo
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()
{
return readOnly;
@ -245,7 +245,7 @@ public class UserInfo extends BaseUserInfo
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()
{
return userManagerId;
@ -256,7 +256,7 @@ public class UserInfo extends BaseUserInfo
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() {
return validationToken;
}

View File

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

View File

@ -51,7 +51,7 @@ public class VerificationStatus
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( )
{
return accessToken;

View File

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