|
| 1 | +Feature: Producer - updateDocumentReference - Duplicate Field Scenarios |
| 2 | + |
| 3 | + Scenario: Duplicate url field in attachment |
| 4 | + Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API |
| 5 | + And the organisation 'TSTCUS' is authorised to access pointer types: |
| 6 | + | system | value | |
| 7 | + | http://snomed.info/sct | 736253002 | |
| 8 | + And a DocumentReference resource exists with values: |
| 9 | + | property | value | |
| 10 | + | id | TSTCUS-updateDuplicateTest-1234 | |
| 11 | + | subject | 9999999999 | |
| 12 | + | status | current | |
| 13 | + | type | 736253002 | |
| 14 | + | category | 734163000 | |
| 15 | + | contentType | application/pdf | |
| 16 | + | url | https://example.org/my-doc.pdf | |
| 17 | + | custodian | TSTCUS | |
| 18 | + | author | TSTCUS | |
| 19 | + When producer 'TSTCUS' requests update of a DocumentReference with pointerId 'TSTCUS-updateDuplicateTest-1234' but replacing 'content': |
| 20 | + """ |
| 21 | + [ |
| 22 | + { |
| 23 | + "attachment": { |
| 24 | + "contentType": "application/pdf", |
| 25 | + "url": "https://example.org/my-doc.pdf", |
| 26 | + "url": "https://example.org/duplicate-url.pdf" |
| 27 | + }, |
| 28 | + "format": { |
| 29 | + "system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode", |
| 30 | + "code": "urn:nhs-ic:unstructured", |
| 31 | + "display": "Unstructured Document" |
| 32 | + }, |
| 33 | + "extension": [ |
| 34 | + { |
| 35 | + "url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability", |
| 36 | + "valueCodeableConcept": { |
| 37 | + "coding": [ |
| 38 | + { |
| 39 | + "system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability", |
| 40 | + "code": "static", |
| 41 | + "display": "Static" |
| 42 | + } |
| 43 | + ] |
| 44 | + } |
| 45 | + } |
| 46 | + ] |
| 47 | + } |
| 48 | + ] |
| 49 | + """ |
| 50 | + Then the response status code is 400 |
| 51 | + And the response is an OperationOutcome with 1 issue |
| 52 | + And the OperationOutcome contains the issue: |
| 53 | + """ |
| 54 | + { |
| 55 | + "severity": "error", |
| 56 | + "code": "invalid", |
| 57 | + "details": { |
| 58 | + "coding": [ |
| 59 | + { |
| 60 | + "system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1", |
| 61 | + "code": "MESSAGE_NOT_WELL_FORMED", |
| 62 | + "display": "Message not well formed" |
| 63 | + } |
| 64 | + ] |
| 65 | + }, |
| 66 | + "diagnostics": "Duplicate keys found in FHIR document: ['url']", |
| 67 | + "expression": [ |
| 68 | + "root.content[0].attachment.url" |
| 69 | + ] |
| 70 | + } |
| 71 | + """ |
| 72 | + |
| 73 | + Scenario: Duplicate format and attachment field in content |
| 74 | + Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API |
| 75 | + And the organisation 'TSTCUS' is authorised to access pointer types: |
| 76 | + | system | value | |
| 77 | + | http://snomed.info/sct | 736253002 | |
| 78 | + And a DocumentReference resource exists with values: |
| 79 | + | property | value | |
| 80 | + | id | TSTCUS-updateDuplicateTest-1235 | |
| 81 | + | subject | 9999999999 | |
| 82 | + | status | current | |
| 83 | + | type | 736253002 | |
| 84 | + | category | 734163000 | |
| 85 | + | contentType | application/pdf | |
| 86 | + | url | https://example.org/my-doc.pdf | |
| 87 | + | custodian | TSTCUS | |
| 88 | + | author | TSTCUS | |
| 89 | + When producer 'TSTCUS' requests update of a DocumentReference with pointerId 'TSTCUS-updateDuplicateTest-1235' but replacing 'content': |
| 90 | + """ |
| 91 | + [ |
| 92 | + { |
| 93 | + "attachment": { |
| 94 | + "contentType": "application/pdf", |
| 95 | + "url": "https://example.org/my-doc.pdf" |
| 96 | + }, |
| 97 | + "attachment": { |
| 98 | + "contentType": "text/html", |
| 99 | + "url": "https://example.org/contact-details.html" |
| 100 | + }, |
| 101 | + "format": { |
| 102 | + "system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode", |
| 103 | + "code": "urn:nhs-ic:unstructured", |
| 104 | + "display": "Unstructured Document" |
| 105 | + }, |
| 106 | + "format": { |
| 107 | + "system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode", |
| 108 | + "code": "urn:nhs-ic:record-contact", |
| 109 | + "display": "Contact details (HTTP Unsecured)" |
| 110 | + }, |
| 111 | + "extension": [ |
| 112 | + { |
| 113 | + "url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability", |
| 114 | + "valueCodeableConcept": { |
| 115 | + "coding": [ |
| 116 | + { |
| 117 | + "system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability", |
| 118 | + "code": "static", |
| 119 | + "display": "Static" |
| 120 | + } |
| 121 | + ] |
| 122 | + } |
| 123 | + } |
| 124 | + ] |
| 125 | + } |
| 126 | + ] |
| 127 | + """ |
| 128 | + Then the response status code is 400 |
| 129 | + And the response is an OperationOutcome with 1 issue |
| 130 | + And the OperationOutcome contains the issue: |
| 131 | + """ |
| 132 | + { |
| 133 | + "severity": "error", |
| 134 | + "code": "invalid", |
| 135 | + "details": { |
| 136 | + "coding": [ |
| 137 | + { |
| 138 | + "system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1", |
| 139 | + "code": "MESSAGE_NOT_WELL_FORMED", |
| 140 | + "display": "Message not well formed" |
| 141 | + } |
| 142 | + ] |
| 143 | + }, |
| 144 | + "diagnostics": "Duplicate keys found in FHIR document: ['attachment', 'format']", |
| 145 | + "expression": [ |
| 146 | + "root.content[0].attachment", |
| 147 | + "root.content[0].format" |
| 148 | + ] |
| 149 | + } |
| 150 | + """ |
0 commit comments