-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: OpenAPI - WebMessage response as oneOf schema [DHIS2-18251] (#18858
) * chore: move AbstractWebMessageResponse to api * chore: cleanup around WebMessage * fix: mvn dependencies * fix: revert of removing some of the XML mapping * fix: remove pre v38 tests * fix: data integrity test asserts * fix: make total read-only [DHIS2-18251] Signed-off-by: Jan Bernitt <[email protected]> * chore: javadoc (sign test) * fix: oneOf for @OpenApi.Property annotated fields * fix: adjust test expectations --------- Signed-off-by: Jan Bernitt <[email protected]>
- Loading branch information
Showing
62 changed files
with
439 additions
and
661 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
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 |
---|---|---|
|
@@ -34,12 +34,14 @@ | |
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.hisp.dhis.common.DxfNamespaces; | ||
import org.hisp.dhis.common.OpenApi; | ||
import org.hisp.dhis.dxf2.importsummary.ImportCount; | ||
|
||
/** | ||
* @author Morten Olav Hansen <[email protected]> | ||
*/ | ||
@JacksonXmlRootElement(localName = "importSummary", namespace = DxfNamespaces.DXF_2_0) | ||
@OpenApi.Shared(name = "ImportTypesSummary") | ||
public class ImportSummary { | ||
private ImportCount importCount = new ImportCount(); | ||
|
||
|
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,31 +36,33 @@ | |
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import javax.annotation.Nonnull; | ||
import org.hisp.dhis.common.DxfNamespaces; | ||
import org.hisp.dhis.dxf2.common.ImportOptions; | ||
import org.hisp.dhis.dxf2.webmessage.AbstractWebMessageResponse; | ||
import org.hisp.dhis.webmessage.WebMessageResponse; | ||
|
||
/** | ||
* @author Morten Olav Hansen <[email protected]> | ||
*/ | ||
@JacksonXmlRootElement(localName = "importSummaries", namespace = DxfNamespaces.DXF_2_0) | ||
public class ImportSummaries extends AbstractWebMessageResponse { | ||
private ImportStatus status = ImportStatus.SUCCESS; | ||
public class ImportSummaries implements WebMessageResponse { | ||
|
||
private ImportStatus status = ImportStatus.SUCCESS; | ||
private int imported; | ||
|
||
private int updated; | ||
|
||
private int deleted; | ||
|
||
private int ignored; | ||
|
||
private ImportOptions importOptions; | ||
|
||
private List<ImportSummary> importSummaries = new ArrayList<>(); | ||
|
||
public ImportSummaries() {} | ||
|
||
@Nonnull | ||
@Override | ||
public Class<? extends WebMessageResponse> getResponseClassType() { | ||
return ImportSummaries.class; | ||
} | ||
|
||
public void addImportSummaries(ImportSummaries importSummaries) { | ||
importSummaries.getImportSummaries().forEach(this::addImportSummary); | ||
} | ||
|
@@ -167,14 +169,12 @@ public int getIgnored() { | |
return ignored; | ||
} | ||
|
||
@JsonProperty | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) | ||
public int getTotal() { | ||
return imported + updated + deleted + ignored; | ||
} | ||
|
||
public void setTotal(int total) {} | ||
|
||
@JsonProperty | ||
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) | ||
public ImportOptions getImportOptions() { | ||
|
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
File renamed without changes.
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
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 |
---|---|---|
|
@@ -30,20 +30,29 @@ | |
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import org.hisp.dhis.common.DxfNamespaces; | ||
import org.hisp.dhis.dxf2.webmessage.AbstractWebMessageResponse; | ||
import org.hisp.dhis.feedback.ErrorReport; | ||
import org.hisp.dhis.webmessage.WebMessageResponse; | ||
|
||
/** | ||
* @author Morten Olav Hansen <[email protected]> | ||
*/ | ||
public class ErrorReportsWebMessageResponse extends AbstractWebMessageResponse { | ||
private List<ErrorReport> errorReports = new ArrayList<>(); | ||
@Setter | ||
@Getter | ||
@RequiredArgsConstructor | ||
public class ErrorReportsWebMessageResponse implements WebMessageResponse { | ||
|
||
public ErrorReportsWebMessageResponse(List<ErrorReport> errorReports) { | ||
this.errorReports = errorReports; | ||
private final List<ErrorReport> errorReports; | ||
|
||
@Nonnull | ||
@Override | ||
public Class<? extends WebMessageResponse> getResponseClassType() { | ||
return ErrorReportsWebMessageResponse.class; | ||
} | ||
|
||
@JsonProperty | ||
|
@@ -55,8 +64,4 @@ public ErrorReportsWebMessageResponse(List<ErrorReport> errorReports) { | |
public List<ErrorReport> getErrorReports() { | ||
return errorReports; | ||
} | ||
|
||
public void setErrorReports(List<ErrorReport> errorReports) { | ||
this.errorReports = errorReports; | ||
} | ||
} |
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
Oops, something went wrong.