Skip to content

Commit f7b0f0d

Browse files
committed
chore(soundsoruce): add validation layer
1 parent 10e7415 commit f7b0f0d

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/main/java/net/onelitefeather/vulpes/backend/domain/sound/SoundFileSourceDTO.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,39 @@
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;
68
import jakarta.validation.constraints.NotNull;
9+
import jakarta.validation.constraints.Positive;
10+
import jakarta.validation.constraints.PositiveOrZero;
711
import net.onelitefeather.vulpes.api.model.sound.SoundFileSource;
812

913
import java.util.UUID;
1014

1115
@Schema(
1216
requiredProperties = {
17+
"name",
18+
"volume",
19+
"pitch",
20+
"weight",
21+
"stream",
22+
"attenuationDistance",
23+
"preload",
24+
"type"
1325
}
1426
)
1527
@Introspected
1628
@Serdeable
1729
public record SoundFileSourceDTO(
1830
UUID id,
19-
String name,
20-
float volume,
21-
float pitch,
22-
int weight,
31+
@NotBlank @NotEmpty String name,
32+
@PositiveOrZero float volume,
33+
@PositiveOrZero float pitch,
34+
@Positive int weight,
2335
boolean stream,
24-
int attenuationDistance,
36+
@Positive int attenuationDistance,
2537
boolean preload,
26-
String type
38+
@NotBlank @NotEmpty String type
2739
) {
2840

2941
/**

0 commit comments

Comments
 (0)