align validation of repository name and namespace

This commit is contained in:
Sebastian Sdorra
2019-03-12 15:10:05 +01:00
parent c180457214
commit f7f5102541
5 changed files with 93 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import sonia.scm.util.ValidationUtil;
import javax.validation.constraints.Pattern;
import java.time.Instant;
@@ -25,8 +26,9 @@ public class RepositoryDto extends HalRepresentation {
private List<HealthCheckFailureDto> healthCheckFailures;
@JsonInclude(JsonInclude.Include.NON_NULL)
private Instant lastModified;
// we could not validate the namespace, this must be done by the namespace strategy
private String namespace;
@Pattern(regexp = "^[A-z0-9\\-_]+$")
@Pattern(regexp = ValidationUtil.REGEX_REPOSITORYNAME)
private String name;
private boolean archived = false;
@NotEmpty