diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 3b60744f..311c2e4b 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,11 +1,11 @@ { "info": { - "_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde", - "name": "Validate Relationship Service Sandbox 06/06/25", + "_postman_id": "4442b3f9-8d89-4aae-a5a9-8a5eda755ead", + "name": "Validate Relationship Service Sandbox 09/06/25", "description": "This Postman collection includes example scenarios for each of the Validated Relationship Service (VRS) API endpoints, covering both valid and invalid request scenarios.\n\nThe collection is pointed towards the VRS sandbox environment, which will return a specific example response based on the request sent. All data shown in the requests or responses is test data.\n\nOur sandbox environment only covers the scenarios listed in the Postman collection and is open access. It does not allow you to test authorisation or any scenarios beyond the ones documented.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "18067099", - "_collection_link": "https://www.postman.com/lunar-crescent-672573/workspace/validated-relationship-service-06-06-25/collection/18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde?action=share&source=collection_link&creator=18067099" + "_exporter_id": "34042403", + "_collection_link": "https://www.postman.com/jackplowman2/validated-relationship-service-sandbox-09-06-25/collection/yzbxyur/validate-relationship-service-sandbox-09-06-25?action=share&source=collection_link&creator=34042403" }, "item": [ { @@ -6096,7 +6096,7 @@ " {", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\",", - " \"code\": \"INVALID_VALUE\",", + " \"code\": \"INVALID_PARAMETER\",", " \"display\": \"Required parameter(s) are invalid.\"", " }", " ]", @@ -6114,7 +6114,7 @@ "});", "", "pm.test(\"Should have correct error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_VALUE\");", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_PARAMETER\");", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -8007,65 +8007,6 @@ }, "response": [] }, - { - "name": "Missing consent ID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"MISSING_ID_VALUE\",", - " \"display\": \"Required parameter(s) are missing.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", - "}", - "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{api_base_url}}/Consent/ ", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - " " - ] - } - }, - "response": [] - }, { "name": "Invalid include parameter", "event": [ @@ -8083,7 +8024,7 @@ " {", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\",", - " \"code\": \"INVALID_VALUE\",", + " \"code\": \"INVALID_PARAMETER\",", " \"display\": \"Required parameter(s) are invalid.\"", " }", " ]", @@ -8148,7 +8089,7 @@ " {", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\",", - " \"code\": \"INVALID_VALUE\",", + " \"code\": \"INVALID_PARAMETER\",", " \"display\": \"Required parameter(s) are invalid.\"", " }", " ]", diff --git a/sandbox/api/constants.py b/sandbox/api/constants.py index 24e94c1a..21094a2c 100644 --- a/sandbox/api/constants.py +++ b/sandbox/api/constants.py @@ -73,7 +73,6 @@ # GET Consent by ID GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml" -GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/missing-id.yaml" # POST Consent POST_CONSENT__DIRECTORY = "./api/examples/POST_Consent/" diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py index 893cc179..ae4e24c1 100644 --- a/sandbox/api/get_consent_by_id.py +++ b/sandbox/api/get_consent_by_id.py @@ -14,7 +14,6 @@ GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER, GET_CONSENT_BY_ID__INVALID_ID_ERROR, - GET_CONSENT_BY_ID__MISSING_ID_ERROR, BAD_REQUEST_INCLUDE_PARAM_INVALID, INVALIDATED_RESOURCE, ) @@ -54,8 +53,6 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: ) elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365": return generate_response_from_example(INVALIDATED_RESOURCE, 404) - elif identifier == " " or identifier is None: - return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR, 400) else: return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR, 400) diff --git a/sandbox/api/tests/test_get_consent_by_id.py b/sandbox/api/tests/test_get_consent_by_id.py index 5031f608..d7eb5907 100644 --- a/sandbox/api/tests/test_get_consent_by_id.py +++ b/sandbox/api/tests/test_get_consent_by_id.py @@ -26,7 +26,7 @@ ( " ", # Missing consent ID "", - "./api/examples/GET_Consent/ID/errors/missing-id.yaml", + "./api/examples/GET_Consent/ID/errors/invalid-id.yaml", 400, ), ( diff --git a/specification/examples/responses/GET_Consent/ID/errors/missing-id.yaml b/specification/examples/responses/GET_Consent/ID/errors/missing-id.yaml deleted file mode 100644 index fc526fc8..00000000 --- a/specification/examples/responses/GET_Consent/ID/errors/missing-id.yaml +++ /dev/null @@ -1,15 +0,0 @@ -ConsentMissingIDError: - summary: Missing ID - description: Error raised due to an missing ID in the request path. - value: - issue: - - code: invalid - diagnostics: "Invalid request with error - ID must be specified in the request path." - details: - coding: - - code: "MISSING_ID_VALUE" - display: "Required parameter(s) are missing." - system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode" - version: "1" - severity: error - resourceType: "OperationOutcome" diff --git a/specification/examples/responses/errors/invalid-include-parameter.yaml b/specification/examples/responses/errors/invalid-include-parameter.yaml index c18d67b3..97ee2a9f 100644 --- a/specification/examples/responses/errors/invalid-include-parameter.yaml +++ b/specification/examples/responses/errors/invalid-include-parameter.yaml @@ -9,7 +9,7 @@ InvalidIncludeParameterError: coding: - system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode" version: "1" - code: "INVALID_VALUE" + code: "INVALID_PARAMETER" display: "Required parameter(s) are invalid." severity: error diagnostics: "Invalid request with error - _include parameter is invalid." diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 01c48093..c97c0c1c 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -126,7 +126,7 @@ info: * only covers a limited set of scenarios * is open access, so does not allow you to test authorisation - [Run In Postman](https://app.getpostman.com/run-collection/18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde%26entityType%3Dcollection%26workspaceId%3D8870ed4a-d599-42a7-ab17-cee80095ffab) + [Run In Postman](https://god.gw.postman.com/run-collection/34042403-4442b3f9-8d89-4aae-a5a9-8a5eda755ead?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D34042403-4442b3f9-8d89-4aae-a5a9-8a5eda755ead%26entityType%3Dcollection%26workspaceId%3D14593107-f7bc-4334-8749-648b96205c76) ### Integration testing @@ -496,7 +496,7 @@ paths: | A single proxy relationship between a mother and child | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` | HTTP Status 200 Bundle containing a single proxy relationship | | A single proxy relationship between a mother and child including details | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `_include` = `Consent:patient` and `_include` = `Consent:proxy` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details | | Invalid status parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `status` = `test` | HTTP Status 422 and INVALID_VALUE error response | - | Invalid include parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `_include` = `test` | HTTP Status 422 and INVALID_VALUE error response | + | Invalid include parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `_include` = `test` | HTTP Status 422 and INVALID_PARAMETER error response | | Missing identifier | `patient:identifier`=`9000000009` | HTTP Status 400 and MISSING_IDENTIFIER_VALUE error response | | Invalid identifier | `identifier`=`900000000` Note: This identifier is 9 characters long, too short to be NHS Number | HTTP Status 422 and INVALID_IDENTIFIER_VALUE error response | | Invalid identifier system | `identifier`=`https://fhir.nhs.uk/Id/nhs-number/9730675929` | HTTP Status 422 and INVALID_IDENTIFIER_SYSTEM error response | @@ -798,9 +798,7 @@ paths: | HTTP status | Error code | Description | | ----------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | - | 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. | - | 400 | `INVALID_VALUE` | Invalid header. For details, see the `diagnostics` field. | - | 400 | `MISSING_ID_VALUE` | Missing id. | + | 400 | `BAD_REQUEST` | Missing header or parameter. For details, see the `diagnostics` field. | | 400 | `NOT_SUPPORTED` | The request is not currently supported. | | 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. | | 403 | `FORBIDDEN` | Access denied to resource. | @@ -808,6 +806,7 @@ paths: | 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. | | 408 | `TIMEOUT` | Request timed out. | | 422 | `INVALID_ID_VALUE` | Invalid id. | + | 422 | `INVALID_PARAMETER` | Invalid parameter. For details, see the `diagnostics` field. | | 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). | content: @@ -819,8 +818,6 @@ paths: $ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError" InvalidatedResourceError: $ref: "./examples/responses/errors/invalidated-resource.yaml#/InvalidatedResourceError" - MissingIdError: - $ref: "./examples/responses/GET_Consent/ID/errors/missing-id.yaml#/ConsentMissingIDError" InvalidIdError: $ref: "./examples/responses/GET_Consent/ID/errors/invalid-id.yaml#/ConsentInvalidIDError" InvalidIncludeParameterError: