io.convergence_platform.common.dto.RequestValidationFieldFailureDTO Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-lib Show documentation
Show all versions of service-lib Show documentation
Holds the common functionality needed by all Convergence Platform-based services written in Java.
The newest version!
package io.convergence_platform.common.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.validation.FieldError;
import java.util.ArrayList;
import java.util.List;
public class RequestValidationFieldFailureDTO {
@JsonProperty("field")
public String field;
@JsonProperty("location")
public String location;
@JsonProperty("error_messages")
public List messages = new ArrayList<>();
public RequestValidationFieldFailureDTO() {
}
public RequestValidationFieldFailureDTO(FieldError fieldError) {
this.field = fieldError.getField();
this.location = "body";
this.messages.add(fieldError.getDefaultMessage());
}
}