Skip to content

Commit 2167767

Browse files
NRL-1285 Replace root in diagnostics for DocumentReference
1 parent 8da54c4 commit 2167767

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

api/producer/createDocumentReference/tests/test_create_document_reference.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ def test_create_document_reference_empty_fields_in_body():
421421
}
422422
],
423423
},
424-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: text, author, custodian.reference, custodian.identifier, category[0].coding[0].system, category[0].coding[0].code)",
425-
"expression": ["root"],
424+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: text, author, custodian.reference, custodian.identifier, category[0].coding[0].system, category[0].coding[0].code)",
425+
"expression": ["DocumentReference"],
426426
}
427427
],
428428
}
@@ -859,8 +859,8 @@ def test_create_document_reference_no_relatesto_target():
859859
}
860860
],
861861
},
862-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: relatesTo[0].target)",
863-
"expression": ["root"],
862+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: relatesTo[0].target)",
863+
"expression": ["DocumentReference"],
864864
}
865865
],
866866
}

api/producer/upsertDocumentReference/tests/test_upsert_document_reference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,8 @@ def test_upsert_document_reference_no_relatesto_target():
782782
}
783783
],
784784
},
785-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: relatesTo[0].target)",
786-
"expression": ["root"],
785+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: relatesTo[0].target)",
786+
"expression": ["DocumentReference"],
787787
}
788788
],
789789
}

layer/nrlf/core/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def append_value_set_url(loc_string: str) -> str:
3535

3636
def diag_for_error(error: ErrorDetails) -> str:
3737
loc_string = format_error_location(error["loc"])
38-
msg = f"{loc_string or 'root'}: {error['msg']}"
38+
msg = f"{loc_string or 'DocumentReference'}: {error['msg']}"
3939
msg += append_value_set_url(loc_string)
4040
return msg
4141

4242

4343
def expression_for_error(error: ErrorDetails) -> Optional[str]:
44-
return format_error_location(error["loc"]) or "root"
44+
return format_error_location(error["loc"]) or "DocumentReference"
4545

4646

4747
class OperationOutcomeError(Exception):

layer/nrlf/core/tests/test_request.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def test_parse_body_invalid_docref_json():
245245
}
246246
],
247247
},
248-
"diagnostics": "Request body could not be parsed (root: Invalid JSON: control character (\\u0000-\\u001F) found while parsing a string at line 72 column 0)",
249-
"expression": ["root"],
248+
"diagnostics": "Request body could not be parsed (DocumentReference: Invalid JSON: control character (\\u0000-\\u001F) found while parsing a string at line 72 column 0)",
249+
"expression": ["DocumentReference"],
250250
}
251251
],
252252
}
@@ -403,8 +403,8 @@ def test_parse_body_not_json():
403403
}
404404
]
405405
},
406-
"diagnostics": "Request body could not be parsed (root: Invalid JSON: expected value at line 1 column 1)",
407-
"expression": ["root"],
406+
"diagnostics": "Request body could not be parsed (DocumentReference: Invalid JSON: expected value at line 1 column 1)",
407+
"expression": ["DocumentReference"],
408408
}
409409
],
410410
}

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,9 @@ Feature: Producer - createDocumentReference - Failure Scenarios
744744
}
745745
]
746746
},
747-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content)",
747+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content)",
748748
"expression": [
749-
"root"
749+
"DocumentReference"
750750
]
751751
}
752752
"""
@@ -802,9 +802,9 @@ Feature: Producer - createDocumentReference - Failure Scenarios
802802
}
803803
]
804804
},
805-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content[0].attachment.contentType)",
805+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content[0].attachment.contentType)",
806806
"expression": [
807-
"root"
807+
"DocumentReference"
808808
]
809809
}
810810
"""
@@ -1008,9 +1008,9 @@ Feature: Producer - createDocumentReference - Failure Scenarios
10081008
}
10091009
]
10101010
},
1011-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: context.practiceSetting.coding[0].display)",
1011+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: context.practiceSetting.coding[0].display)",
10121012
"expression": [
1013-
"root"
1013+
"DocumentReference"
10141014
]
10151015
}
10161016
"""
@@ -1040,7 +1040,7 @@ Feature: Producer - createDocumentReference - Failure Scenarios
10401040
}
10411041
]
10421042
},
1043-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: author)",
1044-
"expression": ["root"]
1043+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: author)",
1044+
"expression": ["DocumentReference"]
10451045
}
10461046
"""

tests/features/producer/updateDocumentReference-failure.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ Feature: Producer - updateDocumentReference - Failure Scenarios
8787
}
8888
]
8989
},
90-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content)",
90+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content)",
9191
"expression": [
92-
"root"
92+
"DocumentReference"
9393
]
9494
}
9595
"""
@@ -158,9 +158,9 @@ Feature: Producer - updateDocumentReference - Failure Scenarios
158158
}
159159
]
160160
},
161-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content[0].attachment.contentType)",
161+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content[0].attachment.contentType)",
162162
"expression": [
163-
"root"
163+
"DocumentReference"
164164
]
165165
}
166166
"""

tests/features/producer/upsertDocumentReference-failure.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ Feature: Producer - upsertDocumentReference - Failure Scenarios
265265
}
266266
]
267267
},
268-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content)",
268+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content)",
269269
"expression": [
270-
"root"
270+
"DocumentReference"
271271
]
272272
}
273273
"""
@@ -323,9 +323,9 @@ Feature: Producer - upsertDocumentReference - Failure Scenarios
323323
}
324324
]
325325
},
326-
"diagnostics": "Request body could not be parsed (root: Value error, The following fields are empty: content[0].attachment.contentType)",
326+
"diagnostics": "Request body could not be parsed (DocumentReference: Value error, The following fields are empty: content[0].attachment.contentType)",
327327
"expression": [
328-
"root"
328+
"DocumentReference"
329329
]
330330
}
331331
"""

0 commit comments

Comments
 (0)