From 81ff048e9030b45c95ae4480dc19ce60280ddd7c Mon Sep 17 00:00:00 2001 From: Sebastian Iancu Date: Tue, 12 Mar 2024 20:07:13 +0100 Subject: [PATCH] generalize response status 400 description (#99 SPECITS-70) --- specifications/operations/composition_create.yaml | 2 +- specifications/operations/composition_update.yaml | 2 +- specifications/operations/definition_query_store.yaml | 2 +- .../operations/definition_query_version_store.yaml | 2 +- .../operations/definition_template_adl1.4_get.yaml | 2 +- .../operations/definition_template_adl1.4_upload.yaml | 2 +- .../operations/definition_template_adl2_get.yaml | 2 +- .../operations/definition_template_adl2_upload.yaml | 2 +- .../operations/definition_template_adl2_version_get.yaml | 2 +- specifications/operations/directory_create.yaml | 2 +- specifications/operations/directory_delete.yaml | 2 +- specifications/operations/directory_update.yaml | 2 +- specifications/operations/ehr_status_get_at_time.yaml | 2 +- .../versioned_ehr_status_version_get_at_time.yaml | 2 +- specifications/responses/400.yaml | 7 ++++++- specifications/responses/400_COMPOSITION.yaml | 6 ------ specifications/responses/400_CONTRIBUTION.yaml | 3 ++- specifications/responses/400_FOLDER.yaml | 2 -- specifications/responses/400_StoredQuery.yaml | 3 --- specifications/responses/400_already_deleted.yaml | 2 +- specifications/responses/400_invalid_ehr_id.yaml | 2 -- specifications/responses/400_invalid_template_content.yaml | 2 -- specifications/responses/400_invalid_template_id.yaml | 2 -- specifications/responses/400_invalid_version_at_time.yaml | 2 -- 24 files changed, 23 insertions(+), 36 deletions(-) delete mode 100644 specifications/responses/400_COMPOSITION.yaml delete mode 100644 specifications/responses/400_FOLDER.yaml delete mode 100644 specifications/responses/400_StoredQuery.yaml delete mode 100644 specifications/responses/400_invalid_ehr_id.yaml delete mode 100644 specifications/responses/400_invalid_template_content.yaml delete mode 100644 specifications/responses/400_invalid_template_id.yaml delete mode 100644 specifications/responses/400_invalid_version_at_time.yaml diff --git a/specifications/operations/composition_create.yaml b/specifications/operations/composition_create.yaml index 3f8c213b..acb92fb7 100644 --- a/specifications/operations/composition_create.yaml +++ b/specifications/operations/composition_create.yaml @@ -19,7 +19,7 @@ responses: '201': $ref: ../responses/201_COMPOSITION.yaml '400': - $ref: ../responses/400_COMPOSITION.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id.yaml '422': diff --git a/specifications/operations/composition_update.yaml b/specifications/operations/composition_update.yaml index 4807dff3..6559b451 100644 --- a/specifications/operations/composition_update.yaml +++ b/specifications/operations/composition_update.yaml @@ -27,7 +27,7 @@ responses: '200': $ref: ../responses/200_COMPOSITION_updated.yaml '400': - $ref: ../responses/400_COMPOSITION.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id_or_uid_based_id.yaml '412': diff --git a/specifications/operations/definition_query_store.yaml b/specifications/operations/definition_query_store.yaml index 77c5bad1..fcfb0c8b 100644 --- a/specifications/operations/definition_query_store.yaml +++ b/specifications/operations/definition_query_store.yaml @@ -25,4 +25,4 @@ responses: '200': $ref: ../responses/200_StoredQuery_stored.yaml '400': - $ref: ../responses/400_StoredQuery.yaml + $ref: ../responses/400.yaml diff --git a/specifications/operations/definition_query_version_store.yaml b/specifications/operations/definition_query_version_store.yaml index 54130485..79efb4c9 100644 --- a/specifications/operations/definition_query_version_store.yaml +++ b/specifications/operations/definition_query_version_store.yaml @@ -26,6 +26,6 @@ responses: '200': $ref: ../responses/200_StoredQuery_stored.yaml '400': - $ref: ../responses/400_StoredQuery.yaml + $ref: ../responses/400.yaml '409': $ref: ../responses/409_StoredQuery_version.yaml diff --git a/specifications/operations/definition_template_adl1.4_get.yaml b/specifications/operations/definition_template_adl1.4_get.yaml index bd0c9188..96d9974b 100644 --- a/specifications/operations/definition_template_adl1.4_get.yaml +++ b/specifications/operations/definition_template_adl1.4_get.yaml @@ -13,7 +13,7 @@ responses: '200': $ref: ../responses/200_Template_adl1_4_retrieved.yaml '400': - $ref: ../responses/400_invalid_template_id.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_template_id.yaml '406': diff --git a/specifications/operations/definition_template_adl1.4_upload.yaml b/specifications/operations/definition_template_adl1.4_upload.yaml index b9cb0591..13f60b29 100644 --- a/specifications/operations/definition_template_adl1.4_upload.yaml +++ b/specifications/operations/definition_template_adl1.4_upload.yaml @@ -72,6 +72,6 @@ responses: '201': $ref: ../responses/201_Template_adl1_4_upload.yaml '400': - $ref: ../responses/400_invalid_template_content.yaml + $ref: ../responses/400.yaml '409': $ref: ../responses/409_template_already_exists.yaml diff --git a/specifications/operations/definition_template_adl2_get.yaml b/specifications/operations/definition_template_adl2_get.yaml index 8a0a65f2..e17c366f 100644 --- a/specifications/operations/definition_template_adl2_get.yaml +++ b/specifications/operations/definition_template_adl2_get.yaml @@ -10,6 +10,6 @@ responses: '200': $ref: ../responses/200_Template_adl2_retrieved.yaml '400': - $ref: ../responses/400_invalid_template_id.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_template_id.yaml diff --git a/specifications/operations/definition_template_adl2_upload.yaml b/specifications/operations/definition_template_adl2_upload.yaml index b2575a03..ddd12172 100644 --- a/specifications/operations/definition_template_adl2_upload.yaml +++ b/specifications/operations/definition_template_adl2_upload.yaml @@ -37,6 +37,6 @@ responses: '201': $ref: ../responses/201_Template_adl2_upload.yaml '400': - $ref: ../responses/400_invalid_template_content.yaml + $ref: ../responses/400.yaml '409': $ref: ../responses/409_template_already_exists.yaml diff --git a/specifications/operations/definition_template_adl2_version_get.yaml b/specifications/operations/definition_template_adl2_version_get.yaml index 16a04b38..8565f85c 100644 --- a/specifications/operations/definition_template_adl2_version_get.yaml +++ b/specifications/operations/definition_template_adl2_version_get.yaml @@ -12,6 +12,6 @@ responses: '200': $ref: ../responses/200_Template_adl2_retrieved.yaml '400': - $ref: ../responses/400_invalid_template_id.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_template_id_or_version.yaml diff --git a/specifications/operations/directory_create.yaml b/specifications/operations/directory_create.yaml index c725d3f9..fb228518 100644 --- a/specifications/operations/directory_create.yaml +++ b/specifications/operations/directory_create.yaml @@ -19,6 +19,6 @@ responses: '201': $ref: ../responses/201_directory.yaml '400': - $ref: ../responses/400_FOLDER.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id.yaml diff --git a/specifications/operations/directory_delete.yaml b/specifications/operations/directory_delete.yaml index cd091835..8ac88caa 100644 --- a/specifications/operations/directory_delete.yaml +++ b/specifications/operations/directory_delete.yaml @@ -13,7 +13,7 @@ responses: '204': $ref: ../responses/204_because_deleted.yaml '400': - $ref: ../responses/400_invalid_ehr_id.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id.yaml '412': diff --git a/specifications/operations/directory_update.yaml b/specifications/operations/directory_update.yaml index 4b0aa7fc..3a7b1372 100644 --- a/specifications/operations/directory_update.yaml +++ b/specifications/operations/directory_update.yaml @@ -24,7 +24,7 @@ responses: '204': $ref: ../responses/204_directory_updated.yaml '400': - $ref: ../responses/400_FOLDER.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id.yaml '412': diff --git a/specifications/operations/ehr_status_get_at_time.yaml b/specifications/operations/ehr_status_get_at_time.yaml index 08de4aa2..24572aa7 100644 --- a/specifications/operations/ehr_status_get_at_time.yaml +++ b/specifications/operations/ehr_status_get_at_time.yaml @@ -13,6 +13,6 @@ responses: '200': $ref: ../responses/200_EHR_STATUS_retrieved.yaml '400': - $ref: ../responses/400_invalid_version_at_time.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id_or_no_version_at_time.yaml diff --git a/specifications/operations/versioned_ehr_status_version_get_at_time.yaml b/specifications/operations/versioned_ehr_status_version_get_at_time.yaml index f9e51925..7c81c092 100644 --- a/specifications/operations/versioned_ehr_status_version_get_at_time.yaml +++ b/specifications/operations/versioned_ehr_status_version_get_at_time.yaml @@ -13,6 +13,6 @@ responses: '200': $ref: ../responses/200_VERSION_of_EHR_STATUS_at_time.yaml '400': - $ref: ../responses/400_invalid_version_at_time.yaml + $ref: ../responses/400.yaml '404': $ref: ../responses/404_unknown_ehr_id_or_no_version_at_time.yaml diff --git a/specifications/responses/400.yaml b/specifications/responses/400.yaml index 6515ea5b..2708605e 100644 --- a/specifications/responses/400.yaml +++ b/specifications/responses/400.yaml @@ -1,2 +1,7 @@ description: | - `400 Bad Request` is returned when the request URL or body (if provided) could not be parsed or has invalid content. + `400 Bad Request` is returned when the request could not be parsed or is invalid (e.g. malformed request URL syntax, missing required header or parameter, or syntactically invalid header, parameter or content). + The response body MAY contain error details. +content: + application/json: + schema: + $ref: ../schemas/others/Error.yaml diff --git a/specifications/responses/400_COMPOSITION.yaml b/specifications/responses/400_COMPOSITION.yaml deleted file mode 100644 index c24abbd2..00000000 --- a/specifications/responses/400_COMPOSITION.yaml +++ /dev/null @@ -1,6 +0,0 @@ -description: | - `400 Bad Request` is returned when the request URL or body (if provided) could not be parsed or has invalid content (e.g. invalid `ehr_id`, or either the body of the request could not be read, or could not be converted to a valid COMPOSITION object). -content: - application/json: - schema: - $ref: ../schemas/others/Error.yaml diff --git a/specifications/responses/400_CONTRIBUTION.yaml b/specifications/responses/400_CONTRIBUTION.yaml index 4367457e..4adf07e5 100644 --- a/specifications/responses/400_CONTRIBUTION.yaml +++ b/specifications/responses/400_CONTRIBUTION.yaml @@ -1,5 +1,6 @@ description: | - `400 Bad Request` is returned when the request URL or body could not be parsed or has invalid content (e.g. invalid `ehr_id`, or either the body of the request not be converted to a valid CONTRIBUTION object, or the modification type doesn’t match the operation - i.e. first version of a composition with MODIFICATION). + `400 Bad Request` is returned when the request could not be parsed or is invalid (e.g. malformed request URL syntax, missing required header or parameter, or syntactically invalid header, parameter or content, or the modification type does not match the operation - i.e. first version of a MODIFICATION). + The response body MAY contain error details. content: application/json: schema: diff --git a/specifications/responses/400_FOLDER.yaml b/specifications/responses/400_FOLDER.yaml deleted file mode 100644 index 728e54aa..00000000 --- a/specifications/responses/400_FOLDER.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: | - `400 Bad Request` is returned when the request URL or body (if provided) could not be parsed or has invalid content (e.g. invalid `ehr_id`, or either the body of the request could not be read, or could not be converted to a valid FOLDER object). diff --git a/specifications/responses/400_StoredQuery.yaml b/specifications/responses/400_StoredQuery.yaml deleted file mode 100644 index 17e2559c..00000000 --- a/specifications/responses/400_StoredQuery.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: | - `400 Bad Request` is returned when the server was unable to store the query. - This could be due to incorrect request body (could not be parsed, etc), unknown query type, etc. diff --git a/specifications/responses/400_already_deleted.yaml b/specifications/responses/400_already_deleted.yaml index b69f3c90..5870c672 100644 --- a/specifications/responses/400_already_deleted.yaml +++ b/specifications/responses/400_already_deleted.yaml @@ -1,2 +1,2 @@ description: | - `400 Bad Request` is returned when the request URL could not be parsed (i.e. invalid format of request parameters) or when the resource identified by the request parameters is already deleted. + `400 Bad Request` is returned when the request could not be parsed or is invalid (e.g. malformed request URL syntax, missing required header or parameter, or syntactically invalid header, parameter or content) or when the resource identified by the request parameters is already deleted. diff --git a/specifications/responses/400_invalid_ehr_id.yaml b/specifications/responses/400_invalid_ehr_id.yaml deleted file mode 100644 index 112d7cac..00000000 --- a/specifications/responses/400_invalid_ehr_id.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: | - `400 Bad Request` is returned when the request has invalid `ehr_id`. diff --git a/specifications/responses/400_invalid_template_content.yaml b/specifications/responses/400_invalid_template_content.yaml deleted file mode 100644 index 28bf1231..00000000 --- a/specifications/responses/400_invalid_template_content.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: | - `400 Bad Request` is returned when unable to upload a template, because of invalid content. diff --git a/specifications/responses/400_invalid_template_id.yaml b/specifications/responses/400_invalid_template_id.yaml deleted file mode 100644 index 9967900e..00000000 --- a/specifications/responses/400_invalid_template_id.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: | - `400 Bad Request` is returned when the request has invalid `template_id` (i.e. an incorrectly formatted `template_id`). diff --git a/specifications/responses/400_invalid_version_at_time.yaml b/specifications/responses/400_invalid_version_at_time.yaml deleted file mode 100644 index 86c6c4b6..00000000 --- a/specifications/responses/400_invalid_version_at_time.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: | - `400 Bad Request` is returned when the request has invalid content such as an invalid `version_at_time` format.