1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
//! TestScript
//!
//! URL: http://hl7.org/fhir/StructureDefinition/TestScript
//!
//! Version: 5.0.0
//!
//! TestScript Resource: A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.
//!
//! FHIR: <https://build.fhir.org/>
//!
//! UML: <https://build.fhir.org/uml.html>
// Allow unused crate::r5::types as types;
#![allow(unused_imports)]
use crate::r5::types;
use ::serde::{Deserialize, Serialize};
use fhir_derive_macros::Validate;
/// A structured set of tests against a FHIR server or client implementation to
/// determine compliance against the FHIR specification.
///
/// TestScript is a conformance resource that describes an executable suite of
/// tests, along with the fixtures, variables, and required server capabilities
/// needed to run them. It organizes work into optional setup, one or more
/// tests, and an optional teardown, where each action is either an operation
/// invoked against a server or an assertion checked against a response. In FHIR
/// R5 it is typically paired with TestReport, which records the outcome of
/// executing a TestScript.
///
/// TestScript is used by FHIR implementers, conformance testing tools, and
/// certification programs to define reusable, machine-executable test suites
/// that exercise a system's REST API operations (such as create, read,
/// search, and update) and validate the responses against expected
/// structural and business-rule assertions. Each abstract `origin` and
/// `destination` server represents a client or server participant in the
/// exchange, `fixture` and `variable` elements supply the data used during
/// execution, and `setup`, `test`, and `teardown` describe the ordered
/// sequence of operations and assertions to run. Because a TestScript is a
/// canonical, versionable conformance resource, it can be published,
/// referenced by an implementation guide, and shared across organizations to
/// support interoperability testing.
///
/// # See also
///
/// - `TestReport` — records the outcome of executing a TestScript.
/// - [`CodeableConcept`](crate::r5::types::CodeableConcept) — used for coded elements such as scope and phase.
/// - [`Identifier`](crate::r5::types::Identifier) — used for the test script's business identifier.
///
/// # Examples
///
/// ```
/// use fhir::r5::resources::test_script::TestScript;
///
/// let value = TestScript::default();
/// let json = ::serde_json::to_value(&value).unwrap();
/// let back: TestScript = ::serde_json::from_value(json).unwrap();
/// assert_eq!(value, back);
/// ```
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScript {
/// Logical id of this artifact
pub id: Option<types::String>,
/// Metadata about the resource
pub meta: Option<types::Meta>,
/// A set of rules under which this content was created
pub implicit_rules: Option<types::Uri>,
/// Primitive extension sibling for [`implicit_rules`](Self::implicit_rules) (FHIR `_implicitRules`).
#[serde(rename = "_implicitRules")]
pub implicit_rules_ext: Option<types::Element>,
/// Language of the resource content
pub language: Option<types::Code>,
/// Primitive extension sibling for [`language`](Self::language) (FHIR `_language`).
#[serde(rename = "_language")]
pub language_ext: Option<types::Element>,
/// Text summary of the resource, for human interpretation
pub text: Option<types::Narrative>,
/// Contained, inline Resources
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub contained: Vec<::serde_json::Value>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Canonical identifier for this test script, represented as a URI (globally unique), used to reference it from other artifacts
pub url: Option<types::Uri>,
/// Primitive extension sibling for [`url`](Self::url) (FHIR `_url`).
#[serde(rename = "_url")]
pub url_ext: Option<types::Element>,
/// Additional identifier for the test script
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub identifier: Vec<types::Identifier>,
/// Business version of the test script
pub version: Option<types::String>,
/// Primitive extension sibling for [`version`](Self::version) (FHIR `_version`).
#[serde(rename = "_version")]
pub version_ext: Option<types::Element>,
/// The `TestScript.versionAlgorithm[x]` choice element (0..1); see [`TestScriptVersionAlgorithm`].
#[serde(flatten)]
pub version_algorithm: Option<TestScriptVersionAlgorithm>,
/// Name for this test script (computer friendly)
pub name: types::String,
/// Primitive extension sibling for [`name`](Self::name) (FHIR `_name`).
#[serde(rename = "_name")]
pub name_ext: Option<types::Element>,
/// Name for this test script (human friendly)
pub title: Option<types::String>,
/// Primitive extension sibling for [`title`](Self::title) (FHIR `_title`).
#[serde(rename = "_title")]
pub title_ext: Option<types::Element>,
/// The publication status of this test script: draft | active | retired | unknown
pub status: crate::r5::coded::Coded<crate::r5::codes::PublicationStatus>,
/// Primitive extension sibling for [`status`](Self::status) (FHIR `_status`).
#[serde(rename = "_status")]
pub status_ext: Option<types::Element>,
/// For testing purposes, not real usage
pub experimental: Option<types::Boolean>,
/// Primitive extension sibling for [`experimental`](Self::experimental) (FHIR `_experimental`).
#[serde(rename = "_experimental")]
pub experimental_ext: Option<types::Element>,
/// Date last changed
pub date: Option<types::DateTime>,
/// Primitive extension sibling for [`date`](Self::date) (FHIR `_date`).
#[serde(rename = "_date")]
pub date_ext: Option<types::Element>,
/// Name of the publisher/steward (organization or individual)
pub publisher: Option<types::String>,
/// Primitive extension sibling for [`publisher`](Self::publisher) (FHIR `_publisher`).
#[serde(rename = "_publisher")]
pub publisher_ext: Option<types::Element>,
/// Contact details for the publisher
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub contact: Vec<types::ContactDetail>,
/// Natural language description of the test script
pub description: Option<types::Markdown>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// The context that the content is intended to support
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub use_context: Vec<types::UsageContext>,
/// Intended jurisdiction for test script (if applicable)
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub jurisdiction: Vec<types::CodeableConcept>,
/// Why this test script is defined
pub purpose: Option<types::Markdown>,
/// Primitive extension sibling for [`purpose`](Self::purpose) (FHIR `_purpose`).
#[serde(rename = "_purpose")]
pub purpose_ext: Option<types::Element>,
/// Use and/or publishing restrictions
pub copyright: Option<types::Markdown>,
/// Primitive extension sibling for [`copyright`](Self::copyright) (FHIR `_copyright`).
#[serde(rename = "_copyright")]
pub copyright_ext: Option<types::Element>,
/// Copyright holder and year(s)
pub copyright_label: Option<types::String>,
/// Primitive extension sibling for [`copyright_label`](Self::copyright_label) (FHIR `_copyrightLabel`).
#[serde(rename = "_copyrightLabel")]
pub copyright_label_ext: Option<types::Element>,
/// An abstract server representing a client or sender in a message exchange
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origin: Vec<TestScriptOrigin>,
/// An abstract server representing a destination or receiver in a message exchange
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub destination: Vec<TestScriptDestination>,
/// Required capability that is assumed to function correctly on the FHIR server being tested
pub metadata: Option<TestScriptMetadata>,
/// Indication of the artifact(s) that are tested by this test case
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub scope: Vec<TestScriptScope>,
/// Fixture in the test script - by reference (uri)
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub fixture: Vec<TestScriptFixture>,
/// Reference of the validation profile
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub profile: Vec<types::Canonical>,
/// Primitive extension sibling for [`profile`](Self::profile) (FHIR `_profile`).
#[serde(rename = "_profile")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub profile_ext: Vec<Option<types::Element>>,
/// Placeholder for evaluated elements
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub variable: Vec<TestScriptVariable>,
/// A series of required setup operations, run once before any tests are executed, that establish the preconditions needed for the test suite
pub setup: Option<TestScriptSetup>,
/// A test in this script, each containing an ordered sequence of operations and assertions that exercise the system under test
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub test: Vec<TestScriptTest>,
/// A series of required clean up steps, run once after all tests complete, that remove fixtures and restore the server to its prior state
pub teardown: Option<TestScriptTeardown>,
}
/// An abstract server representing a client or sender in a message exchange.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptOrigin {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The index of the abstract origin server starting at 1
pub index: types::Integer,
/// Primitive extension sibling for [`index`](Self::index) (FHIR `_index`).
#[serde(rename = "_index")]
pub index_ext: Option<types::Element>,
/// FHIR-Client | FHIR-SDC-FormFiller
pub profile: types::Coding,
/// The url path of the origin server
pub url: Option<types::Url>,
/// Primitive extension sibling for [`url`](Self::url) (FHIR `_url`).
#[serde(rename = "_url")]
pub url_ext: Option<types::Element>,
}
/// An abstract server representing a destination or receiver in a message exchange.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptDestination {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The index of the abstract destination server starting at 1
pub index: types::Integer,
/// Primitive extension sibling for [`index`](Self::index) (FHIR `_index`).
#[serde(rename = "_index")]
pub index_ext: Option<types::Element>,
/// FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
pub profile: types::Coding,
/// The url path of the destination server
pub url: Option<types::Url>,
/// Primitive extension sibling for [`url`](Self::url) (FHIR `_url`).
#[serde(rename = "_url")]
pub url_ext: Option<types::Element>,
}
/// Required capability that is assumed to function correctly on the FHIR server being tested.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptMetadata {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Links to the FHIR specification
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub link: Vec<TestScriptMetadataLink>,
/// Capabilities that are assumed to function correctly on the FHIR server being tested
pub capability: vec1::Vec1<TestScriptMetadataCapability>,
}
/// Links to the FHIR specification that describe the capabilities being tested.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptMetadataLink {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// URL to the specification
pub url: types::Uri,
/// Primitive extension sibling for [`url`](Self::url) (FHIR `_url`).
#[serde(rename = "_url")]
pub url_ext: Option<types::Element>,
/// Short description
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
}
/// Capabilities that are assumed to function correctly on the FHIR server being tested.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptMetadataCapability {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Are the capabilities required?
pub required: types::Boolean,
/// Primitive extension sibling for [`required`](Self::required) (FHIR `_required`).
#[serde(rename = "_required")]
pub required_ext: Option<types::Element>,
/// Are the capabilities validated?
pub validated: types::Boolean,
/// Primitive extension sibling for [`validated`](Self::validated) (FHIR `_validated`).
#[serde(rename = "_validated")]
pub validated_ext: Option<types::Element>,
/// The expected capabilities of the server
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// Which origin server these requirements apply to
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origin: Vec<types::Integer>,
/// Primitive extension sibling for [`origin`](Self::origin) (FHIR `_origin`).
#[serde(rename = "_origin")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origin_ext: Vec<Option<types::Element>>,
/// Which server these requirements apply to
pub destination: Option<types::Integer>,
/// Primitive extension sibling for [`destination`](Self::destination) (FHIR `_destination`).
#[serde(rename = "_destination")]
pub destination_ext: Option<types::Element>,
/// Links to the FHIR specification
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub link: Vec<types::Uri>,
/// Primitive extension sibling for [`link`](Self::link) (FHIR `_link`).
#[serde(rename = "_link")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub link_ext: Vec<Option<types::Element>>,
/// Required Capability Statement
pub capabilities: types::Canonical,
/// Primitive extension sibling for [`capabilities`](Self::capabilities) (FHIR `_capabilities`).
#[serde(rename = "_capabilities")]
pub capabilities_ext: Option<types::Element>,
}
/// Indication of the artifact(s) that are tested by this test case.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptScope {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The specific conformance artifact being tested
pub artifact: types::Canonical,
/// Primitive extension sibling for [`artifact`](Self::artifact) (FHIR `_artifact`).
#[serde(rename = "_artifact")]
pub artifact_ext: Option<types::Element>,
/// required | optional | strict
pub conformance: Option<types::CodeableConcept>,
/// unit | integration | production
pub phase: Option<types::CodeableConcept>,
}
/// Fixture in the test script - by reference (uri).
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptFixture {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Whether or not to implicitly create the fixture during setup
pub autocreate: types::Boolean,
/// Primitive extension sibling for [`autocreate`](Self::autocreate) (FHIR `_autocreate`).
#[serde(rename = "_autocreate")]
pub autocreate_ext: Option<types::Element>,
/// Whether or not to implicitly delete the fixture during teardown
pub autodelete: types::Boolean,
/// Primitive extension sibling for [`autodelete`](Self::autodelete) (FHIR `_autodelete`).
#[serde(rename = "_autodelete")]
pub autodelete_ext: Option<types::Element>,
/// Reference of the resource
pub resource: Option<types::Reference>,
}
/// Placeholder for evaluated elements.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptVariable {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Descriptive name for this variable
pub name: types::String,
/// Primitive extension sibling for [`name`](Self::name) (FHIR `_name`).
#[serde(rename = "_name")]
pub name_ext: Option<types::Element>,
/// Default, hard-coded, or user-defined value for this variable
pub default_value: Option<types::String>,
/// Primitive extension sibling for [`default_value`](Self::default_value) (FHIR `_defaultValue`).
#[serde(rename = "_defaultValue")]
pub default_value_ext: Option<types::Element>,
/// Natural language description of the variable
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// The FHIRPath expression against the fixture body
pub expression: Option<types::String>,
/// Primitive extension sibling for [`expression`](Self::expression) (FHIR `_expression`).
#[serde(rename = "_expression")]
pub expression_ext: Option<types::Element>,
/// HTTP header field name for source
pub header_field: Option<types::String>,
/// Primitive extension sibling for [`header_field`](Self::header_field) (FHIR `_headerField`).
#[serde(rename = "_headerField")]
pub header_field_ext: Option<types::Element>,
/// Hint help text for default value to enter
pub hint: Option<types::String>,
/// Primitive extension sibling for [`hint`](Self::hint) (FHIR `_hint`).
#[serde(rename = "_hint")]
pub hint_ext: Option<types::Element>,
/// XPath or JSONPath against the fixture body
pub path: Option<types::String>,
/// Primitive extension sibling for [`path`](Self::path) (FHIR `_path`).
#[serde(rename = "_path")]
pub path_ext: Option<types::Element>,
/// Fixture Id of source expression or headerField within this variable
pub source_id: Option<types::Id>,
/// Primitive extension sibling for [`source_id`](Self::source_id) (FHIR `_sourceId`).
#[serde(rename = "_sourceId")]
pub source_id_ext: Option<types::Element>,
}
/// A series of required setup operations before tests are executed.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetup {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// A setup operation or assert to perform
pub action: vec1::Vec1<TestScriptSetupAction>,
}
/// A setup operation or assert to perform.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetupAction {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The setup operation to perform
pub operation: Option<TestScriptSetupActionOperation>,
/// The assertion to perform
pub assert: Option<TestScriptSetupActionAssert>,
}
/// The setup operation to perform.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetupActionOperation {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The operation code type that will be executed
pub r#type: Option<types::Coding>,
/// Resource type
pub resource: Option<types::Uri>,
/// Primitive extension sibling for [`resource`](Self::resource) (FHIR `_resource`).
#[serde(rename = "_resource")]
pub resource_ext: Option<types::Element>,
/// Tracking/logging operation label
pub label: Option<types::String>,
/// Primitive extension sibling for [`label`](Self::label) (FHIR `_label`).
#[serde(rename = "_label")]
pub label_ext: Option<types::Element>,
/// Tracking/reporting operation description
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// Mime type to accept in the payload of the response, with charset etc
pub accept: Option<types::Code>,
/// Primitive extension sibling for [`accept`](Self::accept) (FHIR `_accept`).
#[serde(rename = "_accept")]
pub accept_ext: Option<types::Element>,
/// Mime type of the request payload contents, with charset etc
pub content_type: Option<types::Code>,
/// Primitive extension sibling for [`content_type`](Self::content_type) (FHIR `_contentType`).
#[serde(rename = "_contentType")]
pub content_type_ext: Option<types::Element>,
/// Server responding to the request
pub destination: Option<types::Integer>,
/// Primitive extension sibling for [`destination`](Self::destination) (FHIR `_destination`).
#[serde(rename = "_destination")]
pub destination_ext: Option<types::Element>,
/// Whether or not to send the request url in encoded format
pub encode_request_url: types::Boolean,
/// Primitive extension sibling for [`encode_request_url`](Self::encode_request_url) (FHIR `_encodeRequestUrl`).
#[serde(rename = "_encodeRequestUrl")]
pub encode_request_url_ext: Option<types::Element>,
/// delete | get | options | patch | post | put | head
pub method: Option<crate::r5::coded::Coded<crate::r5::codes::HttpOperations>>,
/// Primitive extension sibling for [`method`](Self::method) (FHIR `_method`).
#[serde(rename = "_method")]
pub method_ext: Option<types::Element>,
/// Server initiating the request
pub origin: Option<types::Integer>,
/// Primitive extension sibling for [`origin`](Self::origin) (FHIR `_origin`).
#[serde(rename = "_origin")]
pub origin_ext: Option<types::Element>,
/// Explicitly defined path parameters
pub params: Option<types::String>,
/// Primitive extension sibling for [`params`](Self::params) (FHIR `_params`).
#[serde(rename = "_params")]
pub params_ext: Option<types::Element>,
/// Each operation can have one or more header elements
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub request_header: Vec<TestScriptSetupActionOperationRequestHeader>,
/// Fixture Id of mapped request
pub request_id: Option<types::Id>,
/// Primitive extension sibling for [`request_id`](Self::request_id) (FHIR `_requestId`).
#[serde(rename = "_requestId")]
pub request_id_ext: Option<types::Element>,
/// Fixture Id of mapped response
pub response_id: Option<types::Id>,
/// Primitive extension sibling for [`response_id`](Self::response_id) (FHIR `_responseId`).
#[serde(rename = "_responseId")]
pub response_id_ext: Option<types::Element>,
/// Fixture Id of body for PUT and POST requests
pub source_id: Option<types::Id>,
/// Primitive extension sibling for [`source_id`](Self::source_id) (FHIR `_sourceId`).
#[serde(rename = "_sourceId")]
pub source_id_ext: Option<types::Element>,
/// Id of fixture used for extracting the [id], [type], and [vid] for GET requests
pub target_id: Option<types::Id>,
/// Primitive extension sibling for [`target_id`](Self::target_id) (FHIR `_targetId`).
#[serde(rename = "_targetId")]
pub target_id_ext: Option<types::Element>,
/// Request URL
pub url: Option<types::String>,
/// Primitive extension sibling for [`url`](Self::url) (FHIR `_url`).
#[serde(rename = "_url")]
pub url_ext: Option<types::Element>,
}
/// Each operation can have one or more header elements.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetupActionOperationRequestHeader {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// HTTP header field name
pub field: types::String,
/// Primitive extension sibling for [`field`](Self::field) (FHIR `_field`).
#[serde(rename = "_field")]
pub field_ext: Option<types::Element>,
/// HTTP headerfield value
pub value: types::String,
/// Primitive extension sibling for [`value`](Self::value) (FHIR `_value`).
#[serde(rename = "_value")]
pub value_ext: Option<types::Element>,
}
/// The assertion to perform.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetupActionAssert {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Tracking/logging assertion label
pub label: Option<types::String>,
/// Primitive extension sibling for [`label`](Self::label) (FHIR `_label`).
#[serde(rename = "_label")]
pub label_ext: Option<types::Element>,
/// Tracking/reporting assertion description
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// response | request
pub direction: Option<crate::r5::coded::Coded<crate::r5::codes::AssertDirectionCodes>>,
/// Primitive extension sibling for [`direction`](Self::direction) (FHIR `_direction`).
#[serde(rename = "_direction")]
pub direction_ext: Option<types::Element>,
/// Id of the source fixture to be evaluated
pub compare_to_source_id: Option<types::String>,
/// Primitive extension sibling for [`compare_to_source_id`](Self::compare_to_source_id) (FHIR `_compareToSourceId`).
#[serde(rename = "_compareToSourceId")]
pub compare_to_source_id_ext: Option<types::Element>,
/// The FHIRPath expression to evaluate against the source fixture
pub compare_to_source_expression: Option<types::String>,
/// Primitive extension sibling for [`compare_to_source_expression`](Self::compare_to_source_expression) (FHIR `_compareToSourceExpression`).
#[serde(rename = "_compareToSourceExpression")]
pub compare_to_source_expression_ext: Option<types::Element>,
/// XPath or JSONPath expression to evaluate against the source fixture
pub compare_to_source_path: Option<types::String>,
/// Primitive extension sibling for [`compare_to_source_path`](Self::compare_to_source_path) (FHIR `_compareToSourcePath`).
#[serde(rename = "_compareToSourcePath")]
pub compare_to_source_path_ext: Option<types::Element>,
/// Mime type to compare against the 'Content-Type' header
pub content_type: Option<types::Code>,
/// Primitive extension sibling for [`content_type`](Self::content_type) (FHIR `_contentType`).
#[serde(rename = "_contentType")]
pub content_type_ext: Option<types::Element>,
/// fail | pass | skip | stop
pub default_manual_completion: Option<crate::r5::coded::Coded<crate::r5::codes::AssertManualCompletionCodes>>,
/// Primitive extension sibling for [`default_manual_completion`](Self::default_manual_completion) (FHIR `_defaultManualCompletion`).
#[serde(rename = "_defaultManualCompletion")]
pub default_manual_completion_ext: Option<types::Element>,
/// The FHIRPath expression to be evaluated
pub expression: Option<types::String>,
/// Primitive extension sibling for [`expression`](Self::expression) (FHIR `_expression`).
#[serde(rename = "_expression")]
pub expression_ext: Option<types::Element>,
/// HTTP header field name
pub header_field: Option<types::String>,
/// Primitive extension sibling for [`header_field`](Self::header_field) (FHIR `_headerField`).
#[serde(rename = "_headerField")]
pub header_field_ext: Option<types::Element>,
/// Fixture Id of minimum content resource
pub minimum_id: Option<types::String>,
/// Primitive extension sibling for [`minimum_id`](Self::minimum_id) (FHIR `_minimumId`).
#[serde(rename = "_minimumId")]
pub minimum_id_ext: Option<types::Element>,
/// Perform validation on navigation links?
pub navigation_links: Option<types::Boolean>,
/// Primitive extension sibling for [`navigation_links`](Self::navigation_links) (FHIR `_navigationLinks`).
#[serde(rename = "_navigationLinks")]
pub navigation_links_ext: Option<types::Element>,
/// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval | manualEval
pub operator: Option<crate::r5::coded::Coded<crate::r5::codes::AssertOperatorCodes>>,
/// Primitive extension sibling for [`operator`](Self::operator) (FHIR `_operator`).
#[serde(rename = "_operator")]
pub operator_ext: Option<types::Element>,
/// XPath or JSONPath expression
pub path: Option<types::String>,
/// Primitive extension sibling for [`path`](Self::path) (FHIR `_path`).
#[serde(rename = "_path")]
pub path_ext: Option<types::Element>,
/// delete | get | options | patch | post | put | head
pub request_method: Option<crate::r5::coded::Coded<crate::r5::codes::HttpOperations>>,
/// Primitive extension sibling for [`request_method`](Self::request_method) (FHIR `_requestMethod`).
#[serde(rename = "_requestMethod")]
pub request_method_ext: Option<types::Element>,
/// Request URL comparison value
#[serde(rename = "requestURL")]
pub request_url: Option<types::String>,
/// Resource type
pub resource: Option<types::Uri>,
/// Primitive extension sibling for [`resource`](Self::resource) (FHIR `_resource`).
#[serde(rename = "_resource")]
pub resource_ext: Option<types::Element>,
/// HTTP response status code family
pub response: Option<crate::r5::coded::Coded<crate::r5::codes::AssertResponseCodeTypes>>,
/// Primitive extension sibling for [`response`](Self::response) (FHIR `_response`).
#[serde(rename = "_response")]
pub response_ext: Option<types::Element>,
/// HTTP response code to test
pub response_code: Option<types::String>,
/// Primitive extension sibling for [`response_code`](Self::response_code) (FHIR `_responseCode`).
#[serde(rename = "_responseCode")]
pub response_code_ext: Option<types::Element>,
/// Fixture Id of source expression or headerField
pub source_id: Option<types::Id>,
/// Primitive extension sibling for [`source_id`](Self::source_id) (FHIR `_sourceId`).
#[serde(rename = "_sourceId")]
pub source_id_ext: Option<types::Element>,
/// If this assert fails, will the current test execution stop?
pub stop_test_on_fail: types::Boolean,
/// Primitive extension sibling for [`stop_test_on_fail`](Self::stop_test_on_fail) (FHIR `_stopTestOnFail`).
#[serde(rename = "_stopTestOnFail")]
pub stop_test_on_fail_ext: Option<types::Element>,
/// Profile Id of validation profile reference
pub validate_profile_id: Option<types::Id>,
/// Primitive extension sibling for [`validate_profile_id`](Self::validate_profile_id) (FHIR `_validateProfileId`).
#[serde(rename = "_validateProfileId")]
pub validate_profile_id_ext: Option<types::Element>,
/// The value to compare to
pub value: Option<types::String>,
/// Primitive extension sibling for [`value`](Self::value) (FHIR `_value`).
#[serde(rename = "_value")]
pub value_ext: Option<types::Element>,
/// Will this assert produce a warning only on error?
pub warning_only: types::Boolean,
/// Primitive extension sibling for [`warning_only`](Self::warning_only) (FHIR `_warningOnly`).
#[serde(rename = "_warningOnly")]
pub warning_only_ext: Option<types::Element>,
/// Links or references to the testing requirements
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub requirement: Vec<TestScriptSetupActionAssertRequirement>,
}
/// Links or references to the testing requirements.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptSetupActionAssertRequirement {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The `TestScript.setup.action.assert.requirement.link[x]` choice element (0..1); see [`TestScriptSetupActionAssertRequirementLink`].
#[serde(flatten)]
pub link: Option<TestScriptSetupActionAssertRequirementLink>,
}
/// A test in this script.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptTest {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Tracking/logging name of this test
pub name: Option<types::String>,
/// Primitive extension sibling for [`name`](Self::name) (FHIR `_name`).
#[serde(rename = "_name")]
pub name_ext: Option<types::Element>,
/// Tracking/reporting short description of the test
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// A test operation or assert to perform
pub action: vec1::Vec1<TestScriptTestAction>,
}
/// A test operation or assert to perform.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptTestAction {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The setup operation to perform
pub operation: Option<TestScriptSetupActionOperation>,
/// The setup assertion to perform
pub assert: Option<TestScriptSetupActionAssert>,
}
/// A series of required clean up steps.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptTeardown {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// One or more teardown operations to perform
pub action: vec1::Vec1<TestScriptTeardownAction>,
}
/// One or more teardown operations to perform.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct TestScriptTeardownAction {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// The teardown operation to perform
pub operation: TestScriptSetupActionOperation,
}
#[cfg(test)]
mod tests {
use super::*;
type T = TestScript;
#[test]
fn test_default() {
let _ = T::default();
}
#[test]
fn test_serde_round_trip() {
let value = T::default();
let json = ::serde_json::to_value(&value).expect("to_value");
let back: T = ::serde_json::from_value(json).expect("from_value");
assert_eq!(value, back);
}
}
/// The `TestScript.setup.action.assert.requirement.link[x]` choice element (see spec/11-choice-types.md).
#[derive(Debug, Clone, PartialEq, Eq, fhir_derive_macros::FhirChoice, Validate)]
#[allow(clippy::large_enum_variant)]
pub enum TestScriptSetupActionAssertRequirementLink {
/// `linkUri` variant.
#[fhir("linkUri")]
Uri(crate::r5::choice::Primitive<types::Uri>),
/// `linkCanonical` variant.
#[fhir("linkCanonical")]
Canonical(crate::r5::choice::Primitive<types::Canonical>),
}
/// The `TestScript.versionAlgorithm[x]` choice element (see spec/11-choice-types.md).
#[derive(Debug, Clone, PartialEq, Eq, fhir_derive_macros::FhirChoice, Validate)]
#[allow(clippy::large_enum_variant)]
pub enum TestScriptVersionAlgorithm {
/// `versionAlgorithmString` variant.
#[fhir("versionAlgorithmString")]
String(crate::r5::choice::Primitive<types::String>),
/// `versionAlgorithmCoding` variant.
#[fhir("versionAlgorithmCoding")]
Coding(Box<types::Coding>),
}