Skip to content

Commit

Permalink
Fix/openapi (#172)
Browse files Browse the repository at this point in the history
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: EmVal <[email protected]>
  • Loading branch information
3 people authored Jul 16, 2024
1 parent 4a2fd03 commit accdacf
Show file tree
Hide file tree
Showing 37 changed files with 765 additions and 399 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import java.util.Objects;

@AllArgsConstructor
@Getter
@Setter
public class BankConfigTripletDto {
@Schema(format = "byte", maxLength = 255)
private String acquirerId;
@Schema(format = "byte", maxLength = 255)
private String branchId;
@Schema(format = "byte", maxLength = 255)
private String terminalId;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import java.util.List;
import java.util.UUID;
Expand All @@ -19,7 +20,9 @@ public class BpmnAssociationDto {

@NotNull(message = "defaultTemplateVersion cannot be null")
@Min(value = 1, message = "defaultTemplateVersion must be higher or equal than {value}")
@Schema(minimum = "1", maximum = "10000")
private Long defaultTemplateVersion;

@Schema(maxItems = 10000)
private List<BranchConfigs> branchesConfigs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.core.MediaType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.jboss.resteasy.reactive.PartType;

import java.io.File;
Expand All @@ -22,13 +24,16 @@ public class BpmnCreationDto {
@FormParam("filename")
@NotNull(message = "field is required")
@Pattern(regexp = "^[a-zA-Z0-9_-]+$", message = "deve essere della forma ${regexp} e non contenere l'estensione del file")
@Schema(format = "byte", maxLength = 255)
private String filename;

@FormParam("functionType")
@NotNull(message = "field is required")
@Schema(format = "byte", maxLength = 255)
private String functionType;

@FormParam("description")
@Nullable
@Schema(format = "byte", maxLength = 255)
private String description;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.core.MediaType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.jboss.resteasy.reactive.PartType;

import java.io.File;
Expand All @@ -27,13 +29,16 @@ public class BpmnUpgradeDto {
@FormParam("filename")
@NotNull(message = "filename is required")
@Pattern(regexp = "^[a-zA-Z0-9_-]+$", message = "deve essere della forma ${regexp} e non contenere l'estensione del file")
@Schema(format = "byte", maxLength = 255)
private String filename;

@FormParam("functionType")
@NotNull(message = "function type is required")
@Schema(format = "byte", maxLength = 255)
private String functionType;

@FormParam("description")
@Nullable
@Schema(format = "byte", maxLength = 255)
private String description;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import java.util.List;
import java.util.UUID;
Expand All @@ -12,11 +14,14 @@
@NoArgsConstructor
public class BranchConfigs {

@Schema(format = "byte", maxLength = 255)
private String branchId;

private UUID branchDefaultTemplateId;

@Schema(minimum="1", maximum="10000")
private Long branchDefaultTemplateVersion;

@Schema(maxItems = 100)
private List<TerminalConfigs> terminals;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
Expand All @@ -17,5 +18,6 @@
@EqualsAndHashCode
public class FileS3Dto {

@Size(max = 255)
String fileContent;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import it.gov.pagopa.atmlayer.service.model.enumeration.NoDeployableResourceType;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.FormParam;
import lombok.Data;
Expand All @@ -24,7 +25,7 @@ public class ResourceCreationDto {
@Pattern(regexp = "^[a-zA-Z0-9_-]+\\.[a-zA-Z]+$", message = "it must be of form ${regexp}")
@Schema(description = "Description of the filename parameter: example_filename.txt",
required = true,
pattern = "^[a-zA-Z0-9_-]+\\.[a-zA-Z]+$")
pattern = "^[a-zA-Z0-9_-]+\\.[a-zA-Z]+$", maxLength = 255)
private String filename;

@FormParam("resourceType")
Expand All @@ -35,8 +36,9 @@ public class ResourceCreationDto {
@Pattern(regexp = "(^$)|(^(?!/)[a-zA-Z0-9/]+(?<!/)$)", message = "String must not start or end with '/' and must not contain white spaces and special characters")
@DefaultValue("")
@Schema(description = "Description of the path parameter: example/path",
pattern = "(^$)|(^(?!/)[a-zA-Z0-9/]+(?<!/)$)")
pattern = "(^$)|(^(?!/)[a-zA-Z0-9/]+(?<!/)$)", maxLength = 255)
private String path;
@FormParam("description")
@Schema(format = "byte", maxLength = 255)
private String description;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import java.util.List;
import java.util.UUID;
Expand All @@ -14,8 +17,11 @@
public class TerminalConfigs {
@NotNull
private UUID templateId;

@NotNull
@Schema(minimum = "1", maximum = "10000")
private Long templateVersion;

private List<String> terminalIds;
@Schema(type = SchemaType.ARRAY, maxItems = 10000)
private List<@NotNull @Size(max=20)String> terminalIds;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserProfileAllDto {
@Schema(example = "[email protected]")
@Schema(example = "[email protected]", format = "byte", maxLength = 255)
private String userId;
private UserProfileEnum profile;
@Schema(example = "2024-02-07T11:38:58.445+00:00")
@Schema(example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp createdAt;
@Schema(example = "2024-02-07T11:38:58.445+00:00")
@Schema(example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp lastUpdatedAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class UserProfileCreationDto {

@NotNull(message = "is required")
@Email(message = "must be an email address in the correct format")
@Schema(required = true, example = "[email protected]")
@Schema(required = true, example = "[email protected]", format="byte", maxLength = 255)
private String userId;
@NotNull(message = "is required")
@Schema(required = true, description = "1 = GUEST, 2 = OPERATOR, 3 = ADMIN")
@Schema(required = true, description = "1 = GUEST, 2 = OPERATOR, 3 = ADMIN", minimum = "1", maximum = "10")
private Integer profile;
@Schema(hidden = true)
private Timestamp createdAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserProfileDto {
@Schema(example = "[email protected]")
@Schema(example = "[email protected]", format = "byte", maxLength = 255)
private String userId;
private UserProfileEnum profile;
private Boolean visible;
private Boolean editable;
private Boolean admin;
@Schema(example = "2024-02-07T11:38:58.445+00:00")
@Schema(example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp createdAt;
@Schema(example = "2024-02-07T11:38:58.445+00:00")
@Schema(example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp lastUpdatedAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.core.MediaType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.jboss.resteasy.reactive.PartType;

import java.io.File;
Expand All @@ -23,6 +25,7 @@ public class WorkflowResourceCreationDto {
@FormParam("filename")
@NotNull(message = "filename is required")
@Pattern(regexp = "^[a-zA-Z0-9_-]+$", message = "deve essere della forma ${regexp} e non contenere l'estensione del file")
@Schema(format = "byte", maxLength = 255)
private String filename;

@FormParam("resourceType")
Expand All @@ -31,5 +34,6 @@ public class WorkflowResourceCreationDto {

@FormParam("description")
@Nullable
@Schema(format = "byte", maxLength = 255)
private String description;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
@Getter
public enum AppErrorCodeEnum {
ATMLM_500("ATMLM_500", "Si è verificato un errore imprevisto, vedere i log per ulteriori informazioni", GENERIC),
ATMLM_401("ATMLM_401", "Richiesta non autorizzata", UNAUTHORIZED),
ATMLM_429("ATMLM_429", "Rate limit raggiunto; riprovare in seguito", RATE_LIMIT),
BPMN_FILE_WITH_SAME_CONTENT_ALREADY_EXIST("ATMLM_4000001", "Una risorsa di processo con lo stesso contenuto esiste già", CONSTRAINT_VIOLATION),
BPMN_FILE_DOES_NOT_EXIST("ATMLM_4000002", "La risorsa di processo indicata non esiste", NOT_EXISTING_REFERENCED_ENTITY),
BPMN_FILE_NOT_DEPLOYED("ATMLM_4000003", "La risorsa di processo indicata non è stata rilasciata", NOT_DEPLOYED_STATUS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public enum AppErrorType {
CANNOT_ASSOCIATE,
NOT_EXISTING_USER_ID,
NOT_EXISTING_USER_PROFILE, CANNOT_REPLACE_ASSOCIATION,
UNAUTHORIZED,
RATE_LIMIT,
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.gov.pagopa.atmlayer.service.model.model;

import jakarta.validation.constraints.Size;
import lombok.*;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

Expand All @@ -15,15 +16,22 @@
@EqualsAndHashCode
public class BpmnBankConfigDTO {
private UUID bpmnId;
@Schema(minimum = "1", maximum = "10000")
private Long bpmnModelVersion;
@Schema(format = "byte", maxLength = 255)
private String acquirerId;
@Schema(format = "byte", maxLength = 255)
private String branchId;
@Schema(format = "byte", maxLength = 255)
private String terminalId;
@Schema(format = "byte", maxLength = 255)
private String functionType;
@Schema(description = "Creation Timestamp", format = "date-time", pattern = "DD/MM/YYYY", example = "2023-11-03T14:18:36.635+00:00")
@Schema(description = "Creation Timestamp", format = "date-time", pattern = "DD/MM/YYYY", example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp createdAt;
@Schema(description = "Last Update Timestamp", format = "date-time", pattern = "DD/MM/YYYY", example = "2023-11-03T14:18:36.635+00:00")
@Schema(description = "Last Update Timestamp", format = "date-time", pattern = "DD/MM/YYYY", example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp lastUpdatedAt;
@Schema(format = "byte", maxLength = 255)
private String createdBy;
@Schema(format = "byte", maxLength = 255)
private String lastUpdatedBy;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.gov.pagopa.atmlayer.service.model.model;

import it.gov.pagopa.atmlayer.service.model.enumeration.StatusEnum;
import jakarta.validation.constraints.Size;
import lombok.*;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

Expand All @@ -17,24 +18,35 @@
public class BpmnDTO {

private UUID bpmnId;
@Schema(minimum = "1", maximum = "10000")
private Long modelVersion;
@Schema(format = "byte", maxLength = 255)
private String deployedFileName;
@Schema(format = "byte", maxLength = 255)
private String definitionKey;
@Schema(format = "byte", maxLength = 255)
private String functionType;
private StatusEnum status;
@Schema(format = "byte", maxLength = 255)
private String sha256;
private Boolean enabled;
@Schema(minimum = "1", maximum = "10000")
private Integer definitionVersionCamunda;
@Schema(format = "byte", maxLength = 255)
private String camundaDefinitionId;
@Schema(format = "byte", maxLength = 255)
private String description;
private ResourceFileDTO resourceFile;
@Schema(format = "byte", maxLength = 255)
private String resource;
private UUID deploymentId;
@Schema(description = "Creation Timestamp", format = "timestamp", pattern = "DD/MM/YYYY", example = "2023-11-03T14:18:36.635+00:00")
@Schema(description = "Creation Timestamp", format = "timestamp", pattern = "DD/MM/YYYY", example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp createdAt;
@Schema(description = "Last Update Timestamp", format = "timestamp", pattern = "DD/MM/YYYY", example = "2023-11-03T14:18:36.635+00:00")
@Schema(description = "Last Update Timestamp", format = "timestamp", pattern = "DD/MM/YYYY", example = "{\"date\":\"2023-11-03T14:18:36.635+00:00\"}")
private Timestamp lastUpdatedAt;
@Schema(format = "byte", maxLength = 255)
private String createdBy;
@Schema(format = "byte", maxLength = 255)
private String lastUpdatedBy;

}
Loading

0 comments on commit accdacf

Please sign in to comment.