ppapou commented on a change in pull request #588: [Dlab-1422] The endpoint URL
verification
URL: https://github.com/apache/incubator-dlab/pull/588#discussion_r378888645
##########
File path:
services/self-service/src/main/java/com/epam/dlab/backendapi/domain/EndpointDTO.java
##########
@@ -23,14 +23,22 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hibernate.validator.constraints.URL;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointDTO {
-
+ /*
+ the URL_REGEXP_VALIDATION constant is a template for URL pattern,
+ i.e for url verification like "https://localhost:8084/a/$-*^.oLeh;/"
+ */
+ private static final String URL_REGEXP_VALIDATION =
"^(http(s)?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
+ private static final String URL_RESPONSE_MESSAGE = "is empty or
contains improper format, symbols ";
+ @NotEmpty(message = "endpoint field cannot be empty")
private final String name;
-
+ @URL(regexp = URL_REGEXP_VALIDATION, message = URL_RESPONSE_MESSAGE)
Review comment:
Yes, the template should handle the non-empty case?
Regexp has been teste with empty, blank values.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]