From 38e2ac4edbae9265026d59fffe15f96d70c09072 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:28:18 +1200 Subject: [PATCH 1/4] Changes to error and warning handling Renamed icarErrorResource to icarBatchResultMessage, and added icarBatchResultSeverityType enum. --- enums/icarBatchResultSeverityType.json | 11 +++++++++++ resources/icarBatchResult.json | 12 ++---------- ...rrorResource.json => icarBatchResultMessage.json} | 4 ++++ 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 enums/icarBatchResultSeverityType.json rename resources/{icarErrorResource.json => icarBatchResultMessage.json} (86%) diff --git a/enums/icarBatchResultSeverityType.json b/enums/icarBatchResultSeverityType.json new file mode 100644 index 0000000..c314ae1 --- /dev/null +++ b/enums/icarBatchResultSeverityType.json @@ -0,0 +1,11 @@ +{ + "description": "Severity code to distinguish warnings and errors.", + + "type": "string", + + "enum": [ + "Information", + "Warning", + "Error" + ] + } \ No newline at end of file diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json index a064c83..3f9fe12 100644 --- a/resources/icarBatchResult.json +++ b/resources/icarBatchResult.json @@ -10,20 +10,12 @@ "$ref": "../types/icarMetaDataType.json", "description": "Metadata for the posted resource. Allows specification of the source, source Id to synchronise data." }, - "errors": { + "messages": { "type": "array", "description": "An arry of errors for this resource.", "nullable": true, "items": { - "$ref": "../resources/icarErrorResource.json" - } - }, - "warnings": { - "type": "array", - "description": "An arry of warnings for this resource.", - "nullable": true, - "items": { - "$ref": "../resources/icarErrorResource.json" + "$ref": "../resources/icarBatchResultMessage.json" } } } diff --git a/resources/icarErrorResource.json b/resources/icarBatchResultMessage.json similarity index 86% rename from resources/icarErrorResource.json rename to resources/icarBatchResultMessage.json index aab32e3..8f50b02 100644 --- a/resources/icarErrorResource.json +++ b/resources/icarBatchResultMessage.json @@ -8,6 +8,10 @@ "type": "string", "description": "Machine readable URI or code that defines the type of error or warning." }, + "severity": { + "$ref": "../enums/icarBatchResultSeverityType.json", + "description": "Distinguish errors, warnings, and informational messages." + }, "status": { "type": "integer", "description": "The HTTP status code applicable to this problem.", From 60a799c422ba4acd66e9b1afd4d2ee0e160167ce Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Fri, 30 Jul 2021 13:39:06 +1200 Subject: [PATCH 2/4] Made error handling consistent across single and batch Batch POSTS now always return an array of icarBatchResult, each of which may contain an array of icarErrorWarningMessageResource. Single POSTs if successful return the posted object (ID filled in), otherwise they return an errors array of icarErrorWarningMessageResource. Sorry for renaming the file, but it helped to clarify its purpose. --- resources/icarBatchResult.json | 2 +- ...esultMessage.json => icarErrorWarningMessageResource.json} | 0 url-schemes/healthURLScheme.json | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename resources/{icarBatchResultMessage.json => icarErrorWarningMessageResource.json} (100%) diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json index 3f9fe12..3de52b2 100644 --- a/resources/icarBatchResult.json +++ b/resources/icarBatchResult.json @@ -15,7 +15,7 @@ "description": "An arry of errors for this resource.", "nullable": true, "items": { - "$ref": "../resources/icarBatchResultMessage.json" + "$ref": "../resources/icarErrorWarningMessageResource.json" } } } diff --git a/resources/icarBatchResultMessage.json b/resources/icarErrorWarningMessageResource.json similarity index 100% rename from resources/icarBatchResultMessage.json rename to resources/icarErrorWarningMessageResource.json diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index 586fa0b..29689fa 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -535,8 +535,8 @@ "$ref": "../resources/icarBatchResult.json" } }, - "error": { - "$ref": "../resources/icarErrorResource.json" + "error": { + "$ref": "../resources/icarErrorWarningMessageResource.json" }, "icarDiagnosisEvent": { "$ref": "../resources/icarDiagnosisEventResource.json" From b76071c1dfc53e2cee2ddb594af4451b50bada27 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Fri, 30 Jul 2021 13:44:01 +1200 Subject: [PATCH 3/4] Touch files to resolve conflicts --- resources/icarBatchResult.json | 2 +- url-schemes/healthURLScheme.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json index 3de52b2..20d695c 100644 --- a/resources/icarBatchResult.json +++ b/resources/icarBatchResult.json @@ -15,7 +15,7 @@ "description": "An arry of errors for this resource.", "nullable": true, "items": { - "$ref": "../resources/icarErrorWarningMessageResource.json" + "$ref": "../resources/icarErrorWarningMessageResource.json" } } } diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index 29689fa..a102bf0 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -547,7 +547,7 @@ "icarDiagnosisEventArray": { "type": "array", "items": { - "$ref": "../resources/icarDiagnosisEventResource.json" + "$ref": "../resources/icarDiagnosisEventResource.json" } }, "icarTreatmentEvent": { From 6650449c5b31e1971146a33f91388a9bae05a9c4 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Mon, 2 Aug 2021 13:18:11 +1200 Subject: [PATCH 4/4] Renamed icarErrorWarningMessageResource Renamed icarErrorWarningMessage Resource to icarResponseMessageResource based on feedback to PR #232 --- resources/icarBatchResult.json | 2 +- ...ingMessageResource.json => icarResponseMessageResource.json} | 0 url-schemes/healthURLScheme.json | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename resources/{icarErrorWarningMessageResource.json => icarResponseMessageResource.json} (100%) diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json index 20d695c..e087e80 100644 --- a/resources/icarBatchResult.json +++ b/resources/icarBatchResult.json @@ -15,7 +15,7 @@ "description": "An arry of errors for this resource.", "nullable": true, "items": { - "$ref": "../resources/icarErrorWarningMessageResource.json" + "$ref": "../resources/icarResponseMessageResource.json" } } } diff --git a/resources/icarErrorWarningMessageResource.json b/resources/icarResponseMessageResource.json similarity index 100% rename from resources/icarErrorWarningMessageResource.json rename to resources/icarResponseMessageResource.json diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index a102bf0..f5f4c47 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -536,7 +536,7 @@ } }, "error": { - "$ref": "../resources/icarErrorWarningMessageResource.json" + "$ref": "../resources/icarResponseMessageResource.json" }, "icarDiagnosisEvent": { "$ref": "../resources/icarDiagnosisEventResource.json"