Skip to content

Commit 10bd8f6

Browse files
committed
Merge branch 'develop' of github.com:NHSDigital/NRLF into feature/eema1-NRL-1418-returnOperationOutcomeInSearch
2 parents e60e059 + 0e9c249 commit 10bd8f6

34 files changed

+800
-826
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ awscli 2.15.11
22
poetry 1.8.2
33
jq 1.7.1
44
python 3.12.2
5-
terraform 1.3.4
5+
terraform 1.9.8
66
java zulu-jre-17.42.19
77
yq 4.35.2
88
allure 2.27.0

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ For an easy way to make sure your local system matches the requirements needed y
3636
- [poetry](https://python-poetry.org/docs/) (this repository uses poetry ^1.5.1)
3737
- [pyenv](https://github.com/pyenv/pyenv) (this repository uses python ^3.9.15)
3838
- jq
39-
- terraform (this repository uses terraform ^1.3.4)
40-
- [tfenv](https://github.com/tfutils/tfenv) (this repository uses terraform 1.3.4)
39+
- terraform
40+
- [tfenv](https://github.com/tfutils/tfenv)
4141
- coreutils
4242

4343
Swagger generation requirements.

api/producer/createDocumentReference/create_document_reference.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _check_permissions(
7373
ods_code_parts=metadata.ods_code_parts,
7474
custodian_parts=custodian_parts,
7575
)
76-
return SpineErrorResponse.BAD_REQUEST(
76+
return SpineErrorResponse.UNPROCESSABLE_ENTITY(
7777
diagnostics="The custodian of the provided DocumentReference does not match the expected ODS code for this organisation",
7878
expression="custodian.identifier.value",
7979
)
@@ -201,10 +201,11 @@ def _raise_operation_outcome_error(diagnostics, idx):
201201
"""
202202
raise OperationOutcomeError(
203203
severity="error",
204-
code="invalid",
205-
details=SpineErrorConcept.from_code("BAD_REQUEST"),
204+
code="business-rule",
205+
details=SpineErrorConcept.from_code("UNPROCESSABLE_ENTITY"),
206206
diagnostics=diagnostics,
207207
expression=[f"relatesTo[{idx}].target.identifier.value"],
208+
status_code="422",
208209
)
209210

210211

@@ -236,7 +237,7 @@ def handler(
236237

237238
if not result.is_valid:
238239
logger.log(LogReference.PROCREATE002)
239-
return Response.from_issues(issues=result.issues, statusCode="400")
240+
return Response.from_issues(issues=result.issues, statusCode="422")
240241

241242
core_model = _create_core_model(result.resource, metadata)
242243
if error_response := _check_permissions(core_model, metadata):

0 commit comments

Comments
 (0)