Skip to content

Commit 96e4e3b

Browse files
authored
Merge pull request #220 from NHSDigital/dev/NPA-5090_GET_Consent_Id_Validation_2
NPA-5090 Update GET /Consent/{id} Errors
2 parents bfbc604 + 33ba726 commit 96e4e3b

File tree

7 files changed

+14
-95
lines changed

7 files changed

+14
-95
lines changed

postman/Validate Relationship Service Sandbox.postman_collection.json

Lines changed: 8 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"info": {
3-
"_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde",
4-
"name": "Validate Relationship Service Sandbox 06/06/25",
3+
"_postman_id": "4442b3f9-8d89-4aae-a5a9-8a5eda755ead",
4+
"name": "Validate Relationship Service Sandbox 09/06/25",
55
"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)",
66
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
7-
"_exporter_id": "18067099",
8-
"_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"
7+
"_exporter_id": "34042403",
8+
"_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"
99
},
1010
"item": [
1111
{
@@ -6096,7 +6096,7 @@
60966096
" {",
60976097
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
60986098
" \"version\": \"1\",",
6099-
" \"code\": \"INVALID_VALUE\",",
6099+
" \"code\": \"INVALID_PARAMETER\",",
61006100
" \"display\": \"Required parameter(s) are invalid.\"",
61016101
" }",
61026102
" ]",
@@ -6114,7 +6114,7 @@
61146114
"});",
61156115
"",
61166116
"pm.test(\"Should have correct error response\", () => {",
6117-
" pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_VALUE\");",
6117+
" pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_PARAMETER\");",
61186118
"});",
61196119
"",
61206120
"pm.test(\"Should have correct response body\", () => {",
@@ -8007,65 +8007,6 @@
80078007
},
80088008
"response": []
80098009
},
8010-
{
8011-
"name": "Missing consent ID",
8012-
"event": [
8013-
{
8014-
"listen": "test",
8015-
"script": {
8016-
"exec": [
8017-
"const expectedResponseBody = {",
8018-
" \"issue\": [",
8019-
" {",
8020-
" \"code\": \"invalid\",",
8021-
" \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",",
8022-
" \"details\": {",
8023-
" \"coding\": [",
8024-
" {",
8025-
" \"code\": \"MISSING_ID_VALUE\",",
8026-
" \"display\": \"Required parameter(s) are missing.\",",
8027-
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
8028-
" \"version\": \"1\"",
8029-
" }",
8030-
" ]",
8031-
" },",
8032-
" \"severity\": \"error\"",
8033-
" }",
8034-
" ],",
8035-
" \"resourceType\": \"OperationOutcome\"",
8036-
"}",
8037-
"",
8038-
"const responseJson = pm.response.json();",
8039-
"",
8040-
"pm.test(\"Status code is 400\", function () {",
8041-
" pm.response.to.have.status(400);",
8042-
"});",
8043-
"",
8044-
"pm.test(\"Should have correct response body\", () => {",
8045-
" pm.expect(responseJson).to.eql(expectedResponseBody);",
8046-
"});"
8047-
],
8048-
"type": "text/javascript",
8049-
"packages": {}
8050-
}
8051-
}
8052-
],
8053-
"request": {
8054-
"method": "GET",
8055-
"header": [],
8056-
"url": {
8057-
"raw": "{{api_base_url}}/Consent/ ",
8058-
"host": [
8059-
"{{api_base_url}}"
8060-
],
8061-
"path": [
8062-
"Consent",
8063-
" "
8064-
]
8065-
}
8066-
},
8067-
"response": []
8068-
},
80698010
{
80708011
"name": "Invalid include parameter",
80718012
"event": [
@@ -8083,7 +8024,7 @@
80838024
" {",
80848025
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
80858026
" \"version\": \"1\",",
8086-
" \"code\": \"INVALID_VALUE\",",
8027+
" \"code\": \"INVALID_PARAMETER\",",
80878028
" \"display\": \"Required parameter(s) are invalid.\"",
80888029
" }",
80898030
" ]",
@@ -8148,7 +8089,7 @@
81488089
" {",
81498090
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
81508091
" \"version\": \"1\",",
8151-
" \"code\": \"INVALID_VALUE\",",
8092+
" \"code\": \"INVALID_PARAMETER\",",
81528093
" \"display\": \"Required parameter(s) are invalid.\"",
81538094
" }",
81548095
" ]",

sandbox/api/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373

7474
# GET Consent by ID
7575
GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml"
76-
GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/missing-id.yaml"
7776

7877
# POST Consent
7978
POST_CONSENT__DIRECTORY = "./api/examples/POST_Consent/"

sandbox/api/get_consent_by_id.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT,
1515
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER,
1616
GET_CONSENT_BY_ID__INVALID_ID_ERROR,
17-
GET_CONSENT_BY_ID__MISSING_ID_ERROR,
1817
BAD_REQUEST_INCLUDE_PARAM_INVALID,
1918
INVALIDATED_RESOURCE,
2019
)
@@ -54,8 +53,6 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]:
5453
)
5554
elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365":
5655
return generate_response_from_example(INVALIDATED_RESOURCE, 404)
57-
elif identifier == " " or identifier is None:
58-
return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR, 400)
5956
else:
6057
return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR, 400)
6158

sandbox/api/tests/test_get_consent_by_id.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(
2727
" ", # Missing consent ID
2828
"",
29-
"./api/examples/GET_Consent/ID/errors/missing-id.yaml",
29+
"./api/examples/GET_Consent/ID/errors/invalid-id.yaml",
3030
400,
3131
),
3232
(

specification/examples/responses/GET_Consent/ID/errors/missing-id.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

specification/examples/responses/errors/invalid-include-parameter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ InvalidIncludeParameterError:
99
coding:
1010
- system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode"
1111
version: "1"
12-
code: "INVALID_VALUE"
12+
code: "INVALID_PARAMETER"
1313
display: "Required parameter(s) are invalid."
1414
severity: error
1515
diagnostics: "Invalid request with error - _include parameter is invalid."

specification/validated-relationships-service-api.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ info:
126126
* only covers a limited set of scenarios
127127
* is open access, so does not allow you to test authorisation
128128
129-
[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](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)
129+
[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](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)
130130
131131
### Integration testing
132132
@@ -496,7 +496,7 @@ paths:
496496
| 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 |
497497
| 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 |
498498
| Invalid status parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `status` = `test` | HTTP Status 422 and INVALID_VALUE error response |
499-
| Invalid include parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `_include` = `test` | HTTP Status 422 and INVALID_VALUE error response |
499+
| Invalid include parameter | `performer:identifier`=`9000000019` and/or `patient:identifier`=`9000000009` and `_include` = `test` | HTTP Status 422 and INVALID_PARAMETER error response |
500500
| Missing identifier | `patient:identifier`=`9000000009` | HTTP Status 400 and MISSING_IDENTIFIER_VALUE error response |
501501
| 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 |
502502
| Invalid identifier system | `identifier`=`https://fhir.nhs.uk/Id/nhs-number/9730675929` | HTTP Status 422 and INVALID_IDENTIFIER_SYSTEM error response |
@@ -798,16 +798,15 @@ paths:
798798
799799
| HTTP status | Error code | Description |
800800
| ----------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
801-
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
802-
| 400 | `INVALID_VALUE` | Invalid header. For details, see the `diagnostics` field. |
803-
| 400 | `MISSING_ID_VALUE` | Missing id. |
801+
| 400 | `BAD_REQUEST` | Missing header or parameter. For details, see the `diagnostics` field. |
804802
| 400 | `NOT_SUPPORTED` | The request is not currently supported. |
805803
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
806804
| 403 | `FORBIDDEN` | Access denied to resource. |
807805
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
808806
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
809807
| 408 | `TIMEOUT` | Request timed out. |
810808
| 422 | `INVALID_ID_VALUE` | Invalid id. |
809+
| 422 | `INVALID_PARAMETER` | Invalid parameter. For details, see the `diagnostics` field. |
811810
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
812811
813812
content:
@@ -819,8 +818,6 @@ paths:
819818
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
820819
InvalidatedResourceError:
821820
$ref: "./examples/responses/errors/invalidated-resource.yaml#/InvalidatedResourceError"
822-
MissingIdError:
823-
$ref: "./examples/responses/GET_Consent/ID/errors/missing-id.yaml#/ConsentMissingIDError"
824821
InvalidIdError:
825822
$ref: "./examples/responses/GET_Consent/ID/errors/invalid-id.yaml#/ConsentInvalidIDError"
826823
InvalidIncludeParameterError:

0 commit comments

Comments
 (0)