From edd8e3fc9ce2e4d8a81aa0aa5b9c999dcaa1183a Mon Sep 17 00:00:00 2001 From: Aleksandr Malyshev Date: Wed, 7 Aug 2024 22:41:29 +0300 Subject: [PATCH] [PLAT-14524] Undo all @JsonProperty annotations added earlier to fix APIs Summary: As part of https://phorge.dev.yugabyte.com/D36239 Jackson version for swagger gen was changes to match app jackson version. This caused swagger definitions to change. To fix that, few @JsonProperty annotations were added. However, it seems like swagger definitions were just invalid comparing to actual APIs. So, reverted all the added annotations as part of this diff. Test Plan: itests Reviewers: nsingh, #yba-api-review! Reviewed By: nsingh Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D37146 --- .../yugabyte/yw/forms/BackupTableParams.java | 3 -- .../yugabyte/yw/forms/MetricQueryParams.java | 2 - .../com/yugabyte/yw/models/BackupResp.java | 4 -- .../java/com/yugabyte/yw/models/Schedule.java | 4 ++ .../java/com/yugabyte/yw/models/Users.java | 2 - .../yw/models/helpers/NodeConfig.java | 2 - .../helpers/provider/KubernetesInfo.java | 6 ++- .../src/main/resources/swagger-strict.json | 50 +++++++++++-------- managed/src/main/resources/swagger.json | 50 +++++++++++-------- 9 files changed, 66 insertions(+), 57 deletions(-) diff --git a/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java b/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java index 525d9c7ae106..c9d34a5fb286 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java @@ -3,7 +3,6 @@ package com.yugabyte.yw.forms; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.backuprestore.BackupUtil; import com.yugabyte.yw.models.Backup.StorageConfigType; @@ -341,12 +340,10 @@ public List getTableNameList() { return new ArrayList(); } - @JsonProperty("isFullBackup") public boolean isFullBackup() { return isFullBackup; } - @JsonProperty("isFullBackup") public void setFullBackup(boolean isFullBackup) { this.isFullBackup = isFullBackup; } diff --git a/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java b/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java index 29e933d4faa3..48c7bf5201de 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java @@ -2,7 +2,6 @@ package com.yugabyte.yw.forms; -import com.fasterxml.jackson.annotation.JsonProperty; import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase; import com.yugabyte.yw.metrics.MetricSettings; import com.yugabyte.yw.models.common.YbaApi; @@ -68,7 +67,6 @@ public class MetricQueryParams { @ApiModelProperty(value = "YbaApi Internal. Is Recharts") @YbaApi(visibility = YbaApiVisibility.INTERNAL, sinceYBAVersion = "2.14.0.0") - @JsonProperty("isRecharts") private boolean isRecharts; @ApiModelProperty(value = "YbaApi Internal. List of metrics with custom settings") diff --git a/managed/src/main/java/com/yugabyte/yw/models/BackupResp.java b/managed/src/main/java/com/yugabyte/yw/models/BackupResp.java index e731aa47efb9..f03729744213 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/BackupResp.java +++ b/managed/src/main/java/com/yugabyte/yw/models/BackupResp.java @@ -1,7 +1,6 @@ package com.yugabyte.yw.models; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonProperty; import com.yugabyte.yw.models.Backup.BackupCategory; import com.yugabyte.yw.models.Backup.BackupState; import com.yugabyte.yw.models.Backup.StorageConfigType; @@ -37,10 +36,7 @@ public class BackupResp { Boolean onDemand; StorageConfigType storageConfigType; BackupCategory category; - - @JsonProperty("isFullBackup") Boolean isFullBackup; - TableType backupType; CommonBackupInfo commonBackupInfo; String scheduleName; diff --git a/managed/src/main/java/com/yugabyte/yw/models/Schedule.java b/managed/src/main/java/com/yugabyte/yw/models/Schedule.java index 82a92c86e5ac..c0fcc145efae 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Schedule.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Schedule.java @@ -13,6 +13,8 @@ import com.cronutils.model.time.ExecutionTime; import com.cronutils.parser.CronParser; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -165,6 +167,8 @@ public SortByIF getOrderField() { @Column(nullable = false) private UUID customerUUID; + @JsonProperty + @JsonIgnore public void setCustomerUUID(UUID customerUUID) { this.customerUUID = customerUUID; ObjectNode scheduleTaskParams = (ObjectNode) getTaskParams(); diff --git a/managed/src/main/java/com/yugabyte/yw/models/Users.java b/managed/src/main/java/com/yugabyte/yw/models/Users.java index 4bf17e05e963..f2d4db6f2a8f 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Users.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Users.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; import com.yugabyte.yw.common.PlatformServiceException; import com.yugabyte.yw.common.concurrent.KeyLock; import com.yugabyte.yw.common.encryption.HashBuilder; @@ -173,7 +172,6 @@ public void setPassword(String password) { private Role role; @ApiModelProperty(value = "True if the user is the primary user") - @JsonProperty("isPrimary") private boolean isPrimary; @ApiModelProperty(value = "User Type") diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeConfig.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeConfig.java index 97c16adee51e..7f92ba1fd570 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeConfig.java @@ -36,10 +36,8 @@ public class NodeConfig { @ApiModel(description = "Validation result of a node config") public static class ValidationResult { private Type type; - private boolean valid; private boolean required; - private String description; private String value; } diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/provider/KubernetesInfo.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/provider/KubernetesInfo.java index cf4b248106a8..fafd177ab5d4 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/provider/KubernetesInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/provider/KubernetesInfo.java @@ -1,6 +1,9 @@ package com.yugabyte.yw.models.helpers.provider; -import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.yugabyte.yw.common.CloudProviderHelper.EditableInUseProvider; import com.yugabyte.yw.models.common.YbaApi; import com.yugabyte.yw.models.common.YbaApi.YbaApiVisibility; @@ -77,7 +80,6 @@ public class KubernetesInfo implements CloudInfoInterface { private String kubernetesPullSecretName; @ApiModelProperty(accessMode = AccessMode.READ_ONLY) - @JsonProperty("isKubernetesOperatorControlled") public boolean isKubernetesOperatorControlled = false; // Flag for identifying the legacy k8s providers created before release 2.18. diff --git a/managed/src/main/resources/swagger-strict.json b/managed/src/main/resources/swagger-strict.json index 2bab5b0589d3..9a477d100cc5 100644 --- a/managed/src/main/resources/swagger-strict.json +++ b/managed/src/main/resources/swagger-strict.json @@ -2429,7 +2429,6 @@ "type" : "boolean" }, "isFullBackup" : { - "readOnly" : true, "type" : "boolean" }, "isStorageConfigPresent" : { @@ -2473,7 +2472,7 @@ "type" : "boolean" } }, - "required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ], + "required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isFullBackup", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ], "type" : "object" }, "BackupScheduleEditParams" : { @@ -2670,6 +2669,9 @@ "$ref" : "#/definitions/ExtraDependencies", "description" : "Extra dependencies" }, + "fullBackup" : { + "type" : "boolean" + }, "fullChainSizeInBytes" : { "description" : "Incremental backups chain size", "format" : "int64", @@ -2873,7 +2875,7 @@ "type" : "string" } }, - "required" : [ "creatingUser", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], + "required" : [ "creatingUser", "fullBackup", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], "type" : "object" }, "Basic Auth information" : { @@ -6485,6 +6487,9 @@ "kubernetesImageRegistry" : { "type" : "string" }, + "kubernetesOperatorControlled" : { + "type" : "boolean" + }, "kubernetesProvider" : { "type" : "string" }, @@ -6502,6 +6507,7 @@ "type" : "string" } }, + "required" : [ "kubernetesOperatorControlled" ], "type" : "object" }, "KubernetesOverrideError" : { @@ -6806,6 +6812,9 @@ "kubernetesImageRegistry" : { "type" : "string" }, + "kubernetesOperatorControlled" : { + "type" : "boolean" + }, "kubernetesProvider" : { "type" : "string" }, @@ -6826,6 +6835,7 @@ "type" : "string" } }, + "required" : [ "kubernetesOperatorControlled" ], "type" : "object" }, "LdapDnToYbaRoleData" : { @@ -7202,12 +7212,15 @@ "MetricQueryParams" : { "description" : "Metrics request data", "properties" : { + "recharts" : { + "type" : "boolean" + }, "xclusterConfigUuid" : { "format" : "uuid", "type" : "string" } }, - "required" : [ "xclusterConfigUuid" ], + "required" : [ "recharts", "xclusterConfigUuid" ], "type" : "object" }, "MetricSettings" : { @@ -7339,6 +7352,9 @@ "$ref" : "#/definitions/ExtraDependencies", "description" : "Extra dependencies" }, + "fullBackup" : { + "type" : "boolean" + }, "fullChainSizeInBytes" : { "description" : "Incremental backups chain size", "format" : "int64", @@ -7542,7 +7558,7 @@ "type" : "string" } }, - "required" : [ "creatingUser", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], + "required" : [ "creatingUser", "fullBackup", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], "type" : "object" }, "NamespaceInfoResp" : { @@ -11650,12 +11666,6 @@ "description" : "Cron expression for the schedule", "type" : "string" }, - "customerUUID" : { - "description" : "Customer UUID", - "format" : "uuid", - "readOnly" : true, - "type" : "string" - }, "failureCount" : { "description" : "Number of failed backup attempts", "format" : "int32", @@ -15300,10 +15310,6 @@ "example" : "username1@example.com", "type" : "string" }, - "isPrimary" : { - "description" : "True if the user is the primary user", - "type" : "boolean" - }, "ldapSpecifiedRole" : { "description" : "LDAP Specified Role", "type" : "boolean" @@ -15312,6 +15318,9 @@ "readOnly" : true, "type" : "string" }, + "primary" : { + "type" : "boolean" + }, "role" : { "description" : "User role", "enum" : [ "ConnectOnly", "ReadOnly", "BackupAdmin", "Admin", "SuperAdmin" ], @@ -15333,7 +15342,7 @@ "type" : "string" } }, - "required" : [ "email" ], + "required" : [ "email", "primary" ], "type" : "object" }, "Users" : { @@ -15364,10 +15373,6 @@ "example" : "username1@example.com", "type" : "string" }, - "isPrimary" : { - "description" : "True if the user is the primary user", - "type" : "boolean" - }, "ldapSpecifiedRole" : { "description" : "LDAP Specified Role", "type" : "boolean" @@ -15376,6 +15381,9 @@ "readOnly" : true, "type" : "string" }, + "primary" : { + "type" : "boolean" + }, "role" : { "description" : "User role", "enum" : [ "ConnectOnly", "ReadOnly", "BackupAdmin", "Admin", "SuperAdmin" ], @@ -15397,7 +15405,7 @@ "type" : "string" } }, - "required" : [ "email" ], + "required" : [ "email", "primary" ], "type" : "object" }, "VMImageUpgradeParams" : { diff --git a/managed/src/main/resources/swagger.json b/managed/src/main/resources/swagger.json index 6d3fcbf227cd..44843ad05da9 100644 --- a/managed/src/main/resources/swagger.json +++ b/managed/src/main/resources/swagger.json @@ -2445,7 +2445,6 @@ "type" : "boolean" }, "isFullBackup" : { - "readOnly" : true, "type" : "boolean" }, "isStorageConfigPresent" : { @@ -2489,7 +2488,7 @@ "type" : "boolean" } }, - "required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ], + "required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isFullBackup", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ], "type" : "object" }, "BackupScheduleEditParams" : { @@ -2686,6 +2685,9 @@ "$ref" : "#/definitions/ExtraDependencies", "description" : "Extra dependencies" }, + "fullBackup" : { + "type" : "boolean" + }, "fullChainSizeInBytes" : { "description" : "Incremental backups chain size", "format" : "int64", @@ -2889,7 +2891,7 @@ "type" : "string" } }, - "required" : [ "creatingUser", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], + "required" : [ "creatingUser", "fullBackup", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], "type" : "object" }, "Basic Auth information" : { @@ -6524,6 +6526,9 @@ "kubernetesImageRegistry" : { "type" : "string" }, + "kubernetesOperatorControlled" : { + "type" : "boolean" + }, "kubernetesProvider" : { "type" : "string" }, @@ -6545,6 +6550,7 @@ "type" : "string" } }, + "required" : [ "kubernetesOperatorControlled" ], "type" : "object" }, "KubernetesOverrideError" : { @@ -6849,6 +6855,9 @@ "kubernetesImageRegistry" : { "type" : "string" }, + "kubernetesOperatorControlled" : { + "type" : "boolean" + }, "kubernetesProvider" : { "type" : "string" }, @@ -6873,6 +6882,7 @@ "type" : "string" } }, + "required" : [ "kubernetesOperatorControlled" ], "type" : "object" }, "LdapDnToYbaRoleData" : { @@ -7249,12 +7259,15 @@ "MetricQueryParams" : { "description" : "Metrics request data", "properties" : { + "recharts" : { + "type" : "boolean" + }, "xclusterConfigUuid" : { "format" : "uuid", "type" : "string" } }, - "required" : [ "xclusterConfigUuid" ], + "required" : [ "recharts", "xclusterConfigUuid" ], "type" : "object" }, "MetricSettings" : { @@ -7386,6 +7399,9 @@ "$ref" : "#/definitions/ExtraDependencies", "description" : "Extra dependencies" }, + "fullBackup" : { + "type" : "boolean" + }, "fullChainSizeInBytes" : { "description" : "Incremental backups chain size", "format" : "int64", @@ -7589,7 +7605,7 @@ "type" : "string" } }, - "required" : [ "creatingUser", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], + "required" : [ "creatingUser", "fullBackup", "platformUrl", "platformVersion", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "storageConfigUUID", "timeTakenPartial" ], "type" : "object" }, "NamespaceInfoResp" : { @@ -11758,12 +11774,6 @@ "description" : "Cron expression for the schedule", "type" : "string" }, - "customerUUID" : { - "description" : "Customer UUID", - "format" : "uuid", - "readOnly" : true, - "type" : "string" - }, "failureCount" : { "description" : "Number of failed backup attempts", "format" : "int32", @@ -15428,10 +15438,6 @@ "example" : "username1@example.com", "type" : "string" }, - "isPrimary" : { - "description" : "True if the user is the primary user", - "type" : "boolean" - }, "ldapSpecifiedRole" : { "description" : "LDAP Specified Role", "type" : "boolean" @@ -15440,6 +15446,9 @@ "readOnly" : true, "type" : "string" }, + "primary" : { + "type" : "boolean" + }, "role" : { "description" : "User role", "enum" : [ "ConnectOnly", "ReadOnly", "BackupAdmin", "Admin", "SuperAdmin" ], @@ -15461,7 +15470,7 @@ "type" : "string" } }, - "required" : [ "email" ], + "required" : [ "email", "primary" ], "type" : "object" }, "Users" : { @@ -15492,10 +15501,6 @@ "example" : "username1@example.com", "type" : "string" }, - "isPrimary" : { - "description" : "True if the user is the primary user", - "type" : "boolean" - }, "ldapSpecifiedRole" : { "description" : "LDAP Specified Role", "type" : "boolean" @@ -15504,6 +15509,9 @@ "readOnly" : true, "type" : "string" }, + "primary" : { + "type" : "boolean" + }, "role" : { "description" : "User role", "enum" : [ "ConnectOnly", "ReadOnly", "BackupAdmin", "Admin", "SuperAdmin" ], @@ -15525,7 +15533,7 @@ "type" : "string" } }, - "required" : [ "email" ], + "required" : [ "email", "primary" ], "type" : "object" }, "VMImageUpgradeParams" : {