feat: swagger & requests annotations

This commit is contained in:
Piotr Dec 2024-06-15 00:04:06 +02:00
parent f42dcce74b
commit cf0bf5d97e
Signed by: stawros
GPG key ID: F89F27AD8F881A91
3 changed files with 12 additions and 5 deletions

View file

@ -28,6 +28,7 @@
<!-- dependencies -->
<wiremock.version>3.5.4</wiremock.version>
<openapi.version>2.5.0</openapi.version>
<!-- plugins -->
<jsonschema2pojo.version>1.2.1</jsonschema2pojo.version>
@ -62,6 +63,11 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${openapi.version}</version>
</dependency>
<!-- Database -->
<dependency>

View file

@ -1,6 +1,7 @@
package eu.ztsh.wymiana.web.model;
import eu.ztsh.wymiana.validation.ValidExchangeRequest;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import org.hibernate.validator.constraints.pl.PESEL;
@ -10,11 +11,11 @@ import java.math.BigDecimal;
@Builder
@ValidExchangeRequest
public record CurrencyExchangeRequest(
@PESEL String pesel,
@NotNull @PESEL String pesel,
@NotNull String from,
@NotNull String to,
BigDecimal toBuy,
BigDecimal toSell
@Min(0) BigDecimal toBuy,
@Min(0) BigDecimal toSell
) {
}

View file

@ -12,7 +12,7 @@ import java.math.BigDecimal;
public record UserCreateRequest(
@NotNull String name,
@NotNull String surname,
@PESEL @Adult String pesel,
@Min(0) BigDecimal initial) {
@PESEL @Adult @NotNull String pesel,
@NotNull @Min(0) BigDecimal initial) {
}