Add max fields length validation

This commit is contained in:
Vladyslav_Prykhodko 2021-11-08 16:43:23 +02:00 committed by Andrew Shvayka
parent de44eb4440
commit f02304e2f3
5 changed files with 5 additions and 1 deletions

View File

@ -44,6 +44,7 @@ public abstract class ContactBased<I extends UUIDBased> extends SearchTextBasedW
@Length(fieldName = "phone") @Length(fieldName = "phone")
@NoXss @NoXss
protected String phone; protected String phone;
@Length(fieldName = "email")
@NoXss @NoXss
protected String email; protected String email;

View File

@ -35,6 +35,7 @@ public class DashboardInfo extends SearchTextBased<DashboardId> implements HasNa
@NoXss @NoXss
@Length(fieldName = "title") @Length(fieldName = "title")
private String title; private String title;
@Length(fieldName = "image", max = 1000000)
private String image; private String image;
@Valid @Valid
private Set<ShortCustomerInfo> assignedCustomers; private Set<ShortCustomerInfo> assignedCustomers;

View File

@ -54,6 +54,7 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H
@NoXss @NoXss
@ApiModelProperty(position = 11, value = "Device Profile description. ") @ApiModelProperty(position = 11, value = "Device Profile description. ")
private String description; private String description;
@Length(fieldName = "image", max = 1000000)
@ApiModelProperty(position = 12, value = "Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. ") @ApiModelProperty(position = 12, value = "Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. ")
private String image; private String image;
private boolean isDefault; private boolean isDefault;

View File

@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.validation.NoXss;
@JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" }) @JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" })
public class WidgetTypeDetails extends WidgetType { public class WidgetTypeDetails extends WidgetType {
@NoXss @Length(fieldName = "image", max = 1000000)
@ApiModelProperty(position = 8, value = "Base64 encoded thumbnail", readOnly = true) @ApiModelProperty(position = 8, value = "Base64 encoded thumbnail", readOnly = true)
private String image; private String image;
@NoXss @NoXss

View File

@ -50,6 +50,7 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H
@ApiModelProperty(position = 5, value = "Title used in search and UI", readOnly = true) @ApiModelProperty(position = 5, value = "Title used in search and UI", readOnly = true)
private String title; private String title;
@Length(fieldName = "image", max = 1000000)
@Getter @Getter
@Setter @Setter
@ApiModelProperty(position = 6, value = "Base64 encoded thumbnail", readOnly = true) @ApiModelProperty(position = 6, value = "Base64 encoded thumbnail", readOnly = true)