Skip to content

Commit 3c32399

Browse files
committed
[NRL-829] Fixup unit tests for Pydantic v2 changes. Add Extension types to model.
1 parent f9ff0b8 commit 3c32399

File tree

31 files changed

+411
-314
lines changed

31 files changed

+411
-314
lines changed

api/consumer/countDocumentReference/tests/test_count_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_count_document_reference_missing_nhs_number():
8181
}
8282
]
8383
},
84-
"diagnostics": "Invalid query parameter (subject:identifier: field required)",
84+
"diagnostics": "Invalid query parameter (subject:identifier: Field required)",
8585
"expression": ["subject:identifier"],
8686
}
8787
],

api/consumer/readDocumentReference/tests/test_read_document_reference_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_read_document_reference_missing_id():
105105
}
106106
]
107107
},
108-
"diagnostics": "Invalid path parameter (id: field required)",
108+
"diagnostics": "Invalid path parameter (id: Field required)",
109109
"expression": ["id"],
110110
}
111111
],

api/consumer/searchDocumentReference/search_document_reference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ def handler(
5959
)
6060

6161
custodian_id = (
62-
params.custodian_identifier.__root__.split("|", maxsplit=1)[1]
62+
params.custodian_identifier.root.split("|", maxsplit=1)[1]
6363
if params.custodian_identifier
6464
else None
6565
)
6666
if custodian_id:
6767
self_link += f"&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|{custodian_id}"
6868

69-
pointer_types = [params.type.__root__] if params.type else metadata.pointer_types
69+
pointer_types = [params.type.root] if params.type else metadata.pointer_types
7070
if params.type:
71-
self_link += f"&type={params.type.__root__}"
71+
self_link += f"&type={params.type.root}"
7272

7373
bundle = {
7474
"resourceType": "Bundle",

api/consumer/searchDocumentReference/tests/test_search_document_reference_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def test_search_document_reference_missing_nhs_number(
248248
}
249249
]
250250
},
251-
"diagnostics": "Invalid query parameter (subject:identifier: field required)",
251+
"diagnostics": "Invalid query parameter (subject:identifier: Field required)",
252252
"expression": ["subject:identifier"],
253253
}
254254
],

api/consumer/searchPostDocumentReference/search_post_document_reference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ def handler(
6262
)
6363

6464
custodian_id = (
65-
body.custodian_identifier.__root__.split("|", maxsplit=1)[1]
65+
body.custodian_identifier.root.split("|", maxsplit=1)[1]
6666
if body.custodian_identifier
6767
else None
6868
)
6969
if custodian_id:
7070
self_link += f"&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|{custodian_id}"
7171

72-
pointer_types = [body.type.__root__] if body.type else metadata.pointer_types
72+
pointer_types = [body.type.root] if body.type else metadata.pointer_types
7373
if body.type:
74-
self_link += f"&type={body.type.__root__}"
74+
self_link += f"&type={body.type.root}"
7575

7676
bundle = {
7777
"resourceType": "Bundle",

api/consumer/searchPostDocumentReference/tests/test_search_post_document_reference_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_search_post_document_reference_missing_nhs_number(
212212
}
213213
]
214214
},
215-
"diagnostics": "Request body could not be parsed (subject:identifier: field required)",
215+
"diagnostics": "Request body could not be parsed (subject:identifier: Field required)",
216216
"expression": ["subject:identifier"],
217217
}
218218
],

api/consumer/swagger.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,11 @@ components:
10691069
format:
10701070
$ref: "#/components/schemas/Coding"
10711071
description: An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.
1072+
extension:
1073+
type: array
1074+
items:
1075+
$ref: "#/components/schemas/Extension"
1076+
description: Additional content defined by implementations.
10721077
required:
10731078
- attachment
10741079
DocumentReferenceRelatesTo:
@@ -1143,6 +1148,11 @@ components:
11431148
type: string
11441149
pattern: "[ \\r\\n\\t\\S]+"
11451150
description: A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
1151+
extension:
1152+
type: array
1153+
items:
1154+
$ref: "#/components/schemas/Extension"
1155+
description: Additional content defined by implementations.
11461156
Coding:
11471157
type: object
11481158
properties:
@@ -1169,6 +1179,16 @@ components:
11691179
userSelected:
11701180
type: boolean
11711181
description: Indicates that this coding was chosen by a user directly – e.g. off a pick list of available items (codes or displays).
1182+
Extension:
1183+
type: object
1184+
properties:
1185+
valueCodeableConcept:
1186+
$ref: "#/components/schemas/CodeableConcept"
1187+
description: A name which details the functional use for this link – see [http://www.iana.org/assignments/link–relations/link–relations.xhtml#link–relations–1](http://www.iana.org/assignments/link–relations/link–relations.xhtml#link–relations–1).
1188+
url:
1189+
type: string
1190+
pattern: \S*
1191+
description: The reference details for the link.
11721192
Identifier:
11731193
type: object
11741194
properties:

api/producer/createDocumentReference/tests/test_create_document_reference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_create_document_reference_invalid_body():
220220
}
221221
],
222222
},
223-
"diagnostics": "Request body could not be parsed (resourceType: field required)",
223+
"diagnostics": "Request body could not be parsed (resourceType: Field required)",
224224
"expression": ["resourceType"],
225225
},
226226
{
@@ -235,7 +235,7 @@ def test_create_document_reference_invalid_body():
235235
}
236236
],
237237
},
238-
"diagnostics": "Request body could not be parsed (status: field required)",
238+
"diagnostics": "Request body could not be parsed (status: Field required)",
239239
"expression": ["status"],
240240
},
241241
{
@@ -250,7 +250,7 @@ def test_create_document_reference_invalid_body():
250250
}
251251
],
252252
},
253-
"diagnostics": "Request body could not be parsed (content: field required)",
253+
"diagnostics": "Request body could not be parsed (content: Field required)",
254254
"expression": ["content"],
255255
},
256256
],

api/producer/deleteDocumentReference/tests/test_delete_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_delete_document_reference_invalid_id_in_path():
8686
}
8787
]
8888
},
89-
"diagnostics": "Invalid path parameter (id: field required)",
89+
"diagnostics": "Invalid path parameter (id: Field required)",
9090
"expression": ["id"],
9191
}
9292
],

api/producer/readDocumentReference/tests/test_read_document_reference_producer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_read_document_reference_missing_id():
105105
}
106106
]
107107
},
108-
"diagnostics": "Invalid path parameter (id: field required)",
108+
"diagnostics": "Invalid path parameter (id: Field required)",
109109
"expression": ["id"],
110110
}
111111
],

0 commit comments

Comments
 (0)