Skip to content

Commit 6a95137

Browse files
authored
Merge pull request #354 from NHSDigital/release/2024-10-14
Release/2024-10-14
2 parents 1c7b186 + 27ab8d9 commit 6a95137

35 files changed

+534
-1148
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 2024-10-14
4+
- [PI-534] Errors without FHIR
5+
36
## 2024-10-09
47
- [PI-504] Delete product
58
- [PI-498] Search products

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024.10.09
1+
2024.10.14

changelog/2024-10-14.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [PI-534] Errors without FHIR

infrastructure/terraform/per_workspace/modules/api_entrypoint/api_gateway/api_gateway.tf

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ resource "aws_api_gateway_gateway_response" "api_access_denied" {
8282
response_type = "ACCESS_DENIED"
8383
response_templates = {
8484
"application/json" = jsonencode({
85-
resourceType : "OperationOutcome",
86-
issue : [{
87-
severity : "error",
88-
code : "processing",
89-
diagnostics : "$context.authorizer.error"
85+
errors : [{
86+
code : "PROCESSING"
87+
message : "$context.authorizer.error"
9088
}]
9189
})
9290
}
@@ -100,11 +98,9 @@ resource "aws_api_gateway_gateway_response" "api_default_4xx" {
10098
response_type = "DEFAULT_4XX"
10199
response_templates = {
102100
"application/json" = jsonencode({
103-
resourceType : "OperationOutcome",
104-
issue : [{
105-
severity : "error",
106-
code : "processing"
107-
diagnostics : "$context.error.message"
101+
errors : [{
102+
code : "PROCESSING"
103+
message : "$context.error.message"
108104
}]
109105
}) }
110106
response_parameters = { "gatewayresponse.header.Access-Control-Allow-Origin" = "'*'"
@@ -116,10 +112,9 @@ resource "aws_api_gateway_gateway_response" "api_default_5xx" {
116112
response_type = "DEFAULT_5XX"
117113
response_templates = {
118114
"application/json" = jsonencode({
119-
resourceType : "OperationOutcome",
120-
issue : [{
121-
severity : "error",
122-
code : "exception"
115+
errors : [{
116+
code : "PROCESSING"
117+
message : "exception"
123118
}]
124119
}) }
125120
response_parameters = { "gatewayresponse.header.Access-Control-Allow-Origin" = "'*'"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "connecting-party-manager"
3-
version = "2024.10.09"
3+
version = "2024.10.14"
44
description = "Repository for the Connecting Party Manager API and related services"
55
authors = ["NHS England"]
66
license = "LICENSE.md"

src/api/createCpmProduct/tests/test_index.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,10 @@ def test_index_no_such_product_team(version):
146146
)
147147
expected_result = json.dumps(
148148
{
149-
"resourceType": "OperationOutcome",
150-
"id": app_logger.service_name,
151-
"meta": {
152-
"profile": [
153-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
154-
]
155-
},
156-
"issue": [
149+
"errors": [
157150
{
158-
"severity": "error",
159-
"code": "processing",
160-
"details": {
161-
"coding": [
162-
{
163-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
164-
"code": "RESOURCE_NOT_FOUND",
165-
"display": "Resource not found",
166-
}
167-
]
168-
},
169-
"diagnostics": "Could not find ProductTeam for key ('FOOBAR')",
151+
"code": "RESOURCE_NOT_FOUND",
152+
"message": "Could not find ProductTeam for key ('FOOBAR')",
170153
}
171154
],
172155
}

src/api/createDevice/tests/test_index.py

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -112,73 +112,22 @@ def test_index_bad_payload(version):
112112

113113
expected_body = json.dumps(
114114
{
115-
"resourceType": "OperationOutcome",
116-
"id": app_logger.service_name,
117-
"meta": {
118-
"profile": [
119-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
120-
]
121-
},
122-
"issue": [
115+
"errors": [
123116
{
124-
"severity": "error",
125-
"code": "processing",
126-
"details": {
127-
"coding": [
128-
{
129-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
130-
"code": "MISSING_VALUE",
131-
"display": "Missing value",
132-
}
133-
]
134-
},
135-
"diagnostics": "field required",
136-
"expression": ["Device.resourceType"],
117+
"code": "MISSING_VALUE",
118+
"message": "Device.resourceType: field required",
137119
},
138120
{
139-
"severity": "error",
140-
"code": "processing",
141-
"details": {
142-
"coding": [
143-
{
144-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
145-
"code": "MISSING_VALUE",
146-
"display": "Missing value",
147-
}
148-
]
149-
},
150-
"diagnostics": "field required",
151-
"expression": ["Device.deviceName"],
121+
"code": "MISSING_VALUE",
122+
"message": "Device.deviceName: field required",
152123
},
153124
{
154-
"severity": "error",
155-
"code": "processing",
156-
"details": {
157-
"coding": [
158-
{
159-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
160-
"code": "MISSING_VALUE",
161-
"display": "Missing value",
162-
}
163-
]
164-
},
165-
"diagnostics": "field required",
166-
"expression": ["Device.definition"],
125+
"code": "MISSING_VALUE",
126+
"message": "Device.definition: field required",
167127
},
168128
{
169-
"severity": "error",
170-
"code": "processing",
171-
"details": {
172-
"coding": [
173-
{
174-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
175-
"code": "MISSING_VALUE",
176-
"display": "Missing value",
177-
}
178-
]
179-
},
180-
"diagnostics": "field required",
181-
"expression": ["Device.owner"],
129+
"code": "MISSING_VALUE",
130+
"message": "Device.owner: field required",
182131
},
183132
],
184133
}

src/api/createProductTeam/tests/test_index.py

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -98,73 +98,22 @@ def test_index_bad_payload(version):
9898

9999
expected_body = json.dumps(
100100
{
101-
"resourceType": "OperationOutcome",
102-
"id": app_logger.service_name,
103-
"meta": {
104-
"profile": [
105-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
106-
]
107-
},
108-
"issue": [
101+
"errors": [
109102
{
110-
"severity": "error",
111-
"code": "processing",
112-
"details": {
113-
"coding": [
114-
{
115-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
116-
"code": "MISSING_VALUE",
117-
"display": "Missing value",
118-
}
119-
]
120-
},
121-
"diagnostics": "field required",
122-
"expression": ["Organization.resourceType"],
103+
"code": "MISSING_VALUE",
104+
"message": "Organization.resourceType: field required",
123105
},
124106
{
125-
"severity": "error",
126-
"code": "processing",
127-
"details": {
128-
"coding": [
129-
{
130-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
131-
"code": "MISSING_VALUE",
132-
"display": "Missing value",
133-
}
134-
]
135-
},
136-
"diagnostics": "field required",
137-
"expression": ["Organization.identifier"],
107+
"code": "MISSING_VALUE",
108+
"message": "Organization.identifier: field required",
138109
},
139110
{
140-
"severity": "error",
141-
"code": "processing",
142-
"details": {
143-
"coding": [
144-
{
145-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
146-
"code": "MISSING_VALUE",
147-
"display": "Missing value",
148-
}
149-
]
150-
},
151-
"diagnostics": "field required",
152-
"expression": ["Organization.name"],
111+
"code": "MISSING_VALUE",
112+
"message": "Organization.name: field required",
153113
},
154114
{
155-
"severity": "error",
156-
"code": "processing",
157-
"details": {
158-
"coding": [
159-
{
160-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
161-
"code": "MISSING_VALUE",
162-
"display": "Missing value",
163-
}
164-
]
165-
},
166-
"diagnostics": "field required",
167-
"expression": ["Organization.partOf"],
115+
"code": "MISSING_VALUE",
116+
"message": "Organization.partOf: field required",
168117
},
169118
],
170119
}

src/api/readCpmProduct/tests/test_index.py

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from domain.repository.cpm_product_repository.v3 import CpmProductRepository
88
from domain.repository.product_team_repository.v2 import ProductTeamRepository
99
from event.json import json_loads
10-
from nhs_context_logging import app_logger
1110

1211
from test_helpers.dynamodb import mock_table
1312
from test_helpers.response_assertions import _response_assertions
@@ -126,27 +125,10 @@ def test_index_no_such_cpm_product(version):
126125

127126
expected_result = json.dumps(
128127
{
129-
"resourceType": "OperationOutcome",
130-
"id": app_logger.service_name,
131-
"meta": {
132-
"profile": [
133-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
134-
]
135-
},
136-
"issue": [
128+
"errors": [
137129
{
138-
"severity": "error",
139-
"code": "processing",
140-
"details": {
141-
"coding": [
142-
{
143-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
144-
"code": "RESOURCE_NOT_FOUND",
145-
"display": "Resource not found",
146-
}
147-
]
148-
},
149-
"diagnostics": f"Could not find CpmProduct for key ('{PRODUCT_TEAM_ID}', '{PRODUCT_ID}')",
130+
"code": "RESOURCE_NOT_FOUND",
131+
"message": f"Could not find CpmProduct for key ('{PRODUCT_TEAM_ID}', '{PRODUCT_ID}')",
150132
}
151133
],
152134
}
@@ -207,27 +189,10 @@ def test_index_no_such_product_team(version):
207189

208190
expected_result = json.dumps(
209191
{
210-
"resourceType": "OperationOutcome",
211-
"id": app_logger.service_name,
212-
"meta": {
213-
"profile": [
214-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
215-
]
216-
},
217-
"issue": [
192+
"errors": [
218193
{
219-
"severity": "error",
220-
"code": "processing",
221-
"details": {
222-
"coding": [
223-
{
224-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
225-
"code": "RESOURCE_NOT_FOUND",
226-
"display": "Resource not found",
227-
}
228-
]
229-
},
230-
"diagnostics": f"Could not find ProductTeam for key ('{PRODUCT_TEAM_ID}')",
194+
"code": "RESOURCE_NOT_FOUND",
195+
"message": f"Could not find ProductTeam for key ('{PRODUCT_TEAM_ID}')",
231196
}
232197
],
233198
}

src/api/readDevice/tests/test_index.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from domain.core.device_key import DeviceKeyType
77
from domain.core.root import Root
88
from domain.repository.device_repository import DeviceRepository
9-
from nhs_context_logging import app_logger
109

1110
from test_helpers.dynamodb import mock_table
1211
from test_helpers.response_assertions import _response_assertions
@@ -115,27 +114,10 @@ def test_index_no_such_device(version):
115114

116115
expected_result = json.dumps(
117116
{
118-
"resourceType": "OperationOutcome",
119-
"id": app_logger.service_name,
120-
"meta": {
121-
"profile": [
122-
"https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome"
123-
]
124-
},
125-
"issue": [
117+
"errors": [
126118
{
127-
"severity": "error",
128-
"code": "processing",
129-
"details": {
130-
"coding": [
131-
{
132-
"system": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
133-
"code": "RESOURCE_NOT_FOUND",
134-
"display": "Resource not found",
135-
}
136-
]
137-
},
138-
"diagnostics": "Could not find Device for key ('123')",
119+
"code": "RESOURCE_NOT_FOUND",
120+
"message": "Could not find Device for key ('123')",
139121
}
140122
],
141123
}

0 commit comments

Comments
 (0)