Skip to content

Commit 43271be

Browse files
committed
chore(attribute): add improved value validation
1 parent f410f59 commit 43271be

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/net/onelitefeather/vulpes/backend/domain/attribute/AttributeModelDTO.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import io.micronaut.core.annotation.Introspected;
44
import io.micronaut.serde.annotation.Serdeable;
55
import io.swagger.v3.oas.annotations.media.Schema;
6+
import jakarta.validation.constraints.NotBlank;
7+
import jakarta.validation.constraints.NotEmpty;
8+
import jakarta.validation.constraints.Positive;
9+
import jakarta.validation.constraints.PositiveOrZero;
610
import net.onelitefeather.vulpes.api.model.AttributeEntity;
711

812
import java.util.UUID;
@@ -13,9 +17,9 @@
1317
public record AttributeModelDTO(
1418
@Schema(description = "ID of the attribute", requiredMode = Schema.RequiredMode.NOT_REQUIRED) UUID id,
1519
@Schema(description = "The name for the ui", requiredMode = Schema.RequiredMode.REQUIRED) String uiName,
16-
@Schema(description = "The name which represents the variable after the generation", requiredMode = Schema.RequiredMode.REQUIRED) String variableName,
17-
@Schema(description = "Default value of the attribute", requiredMode = Schema.RequiredMode.REQUIRED) double defaultValue,
18-
@Schema(description = "Maximum value of the attribute", requiredMode = Schema.RequiredMode.REQUIRED) double maximumValue
20+
@Schema(description = "The name which represents the variable after the generation", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty @NotBlank String variableName,
21+
@Schema(description = "Default value of the attribute", requiredMode = Schema.RequiredMode.REQUIRED) @PositiveOrZero double defaultValue,
22+
@Schema(description = "Maximum value of the attribute", requiredMode = Schema.RequiredMode.REQUIRED) @Positive double maximumValue
1923
) {
2024
public AttributeEntity toAttributeModel() {
2125
return new AttributeEntity(id, uiName, variableName, defaultValue, maximumValue);

0 commit comments

Comments
 (0)