-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP-12355: Unhappy paths for updating a service name (#5255)
* PP-12355: Unhappy paths for updating a service name In line with other endpoints, we're also using a class `UpdateServiceNameRequest` to represent the body of an API request, rather than more inefficient way of passing in a Map and doing manual validation on that.
- Loading branch information
1 parent
782cae1
commit 539ef12
Showing
6 changed files
with
92 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/uk/gov/pay/connector/gatewayaccount/model/UpdateServiceNameRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package uk.gov.pay.connector.gatewayaccount.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import org.hibernate.validator.constraints.Length; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class UpdateServiceNameRequest { | ||
|
||
@NotNull(message = "Field [service_name] cannot be null") | ||
@Length(max = 50, min = 1, message = "Field [service_name] can have a size between 1 and 50") | ||
private String serviceName; | ||
|
||
public String getServiceName() { | ||
return serviceName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters