Skip to content

Commit

Permalink
PAT-320: Renamed v1 Alert class to AlertV1 to prevent springfox issue…
Browse files Browse the repository at this point in the history
… wth generating swagger docs. See issue springfox/springfox#182 - where the package is ignored for classes with the same name, which caused /api/bookings/{bookingId} to incorrectly show the alert structure for model/v1/Alert.java, not model/Alert.java.
  • Loading branch information
timharrison-moj committed Nov 8, 2019
1 parent 3658b1c commit a78a649
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@ToString
@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({"alert_type", "alert_sub_type", "alert_date", "expiry_date", "status", "comment"})
public class Alert {
public class AlertV1 {

@ApiModelProperty(value = "Code and description identifying the type of alert", required = true, example = "{ code: 'X', desc: 'Security' }")
@JsonProperty("alert_type")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/syscon/elite/api/model/v1/Alerts.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
@ToString
public class Alerts {
@ApiModelProperty(value = "Alerts", allowEmptyValue = true)
private List<Alert> alerts;
private List<AlertV1> alerts;
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ private Charge buildCharge(final ChargeSP charge) {
.build();
}

public List<Alert> getAlerts(final String nomsId, final boolean includeInactive, final LocalDateTime modifiedSince) {
public List<AlertV1> getAlerts(final String nomsId, final boolean includeInactive, final LocalDateTime modifiedSince) {
final var alerts = alertV1Repository.getAlerts(nomsId, includeInactive, modifiedSince).stream()
.filter(a -> a.getAlertSeq() != null)
.map(a -> Alert.builder()
.map(a -> AlertV1.builder()
.type(CodeDescription.safeNullBuild(a.getAlertType(), a.getAlertTypeDesc()))
.subType(CodeDescription.safeNullBuild(a.getAlertCode(), a.getAlertCodeDesc()))
.date(a.getAlertDate())
Expand Down

0 comments on commit a78a649

Please sign in to comment.