fhir 0.1.0

Fast Healthcare Interoperability Resources (FHIR) API is a standardized, RESTful interface for exchanging electronic health records.
Documentation
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
//! 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>,

    /// Language of the resource content
    pub language: Option<types::Code>,

    /// Text summary of the resource, for human interpretation
    pub text: Option<types::Narrative>,

    /// Contained, inline Resources
    pub contained: Option<Vec<::serde_json::Value>>,

    /// Additional content defined by implementations
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored
    pub modifier_extension: Option<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>,

    /// Additional identifier for the test script
    pub identifier: Option<Vec<types::Identifier>>,

    /// Business version of the test script
    pub version: Option<types::String>,

    /// How to compare versions
    pub version_algorithm_string: Option<types::String>,

    /// How to compare versions
    pub version_algorithm_coding: Option<types::Coding>,

    /// Name for this test script (computer friendly)
    pub name: types::String,

    /// Name for this test script (human friendly)
    pub title: Option<types::String>,

    /// The publication status of this test script: draft | active | retired | unknown
    pub status: types::Code,

    /// For testing purposes, not real usage
    pub experimental: Option<types::Boolean>,

    /// Date last changed
    pub date: Option<types::DateTime>,

    /// Name of the publisher/steward (organization or individual)
    pub publisher: Option<types::String>,

    /// Contact details for the publisher
    pub contact: Option<Vec<types::ContactDetail>>,

    /// Natural language description of the test script
    pub description: Option<types::Markdown>,

    /// The context that the content is intended to support
    pub use_context: Option<Vec<types::UsageContext>>,

    /// Intended jurisdiction for test script (if applicable)
    pub jurisdiction: Option<Vec<types::CodeableConcept>>,

    /// Why this test script is defined
    pub purpose: Option<types::Markdown>,

    /// Use and/or publishing restrictions
    pub copyright: Option<types::Markdown>,

    /// Copyright holder and year(s)
    pub copyright_label: Option<types::String>,

    /// An abstract server representing a client or sender in a message exchange
    pub origin: Option<Vec<TestScriptOrigin>>,

    /// An abstract server representing a destination or receiver in a message exchange
    pub destination: Option<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
    pub scope: Option<Vec<TestScriptScope>>,

    /// Fixture in the test script - by reference (uri)
    pub fixture: Option<Vec<TestScriptFixture>>,

    /// Reference of the validation profile
    pub profile: Option<Vec<types::Canonical>>,

    /// Placeholder for evaluated elements
    pub variable: Option<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
    pub test: Option<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// The index of the abstract origin server starting at 1
    pub index: types::Integer,

    /// FHIR-Client | FHIR-SDC-FormFiller
    pub profile: types::Coding,

    /// The url path of the origin server
    pub url: Option<types::Url>,
}

/// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// The index of the abstract destination server starting at 1
    pub index: types::Integer,

    /// 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>,
}

/// Required capability that is 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 TestScriptMetadata {
    /// Unique id for inter-element referencing
    pub id: Option<types::String>,

    /// Additional content defined by implementations
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Links to the FHIR specification
    pub link: Option<Vec<TestScriptMetadataLink>>,

    /// Capabilities  that are assumed to function correctly on the FHIR server being tested
    pub capability: Vec<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// URL to the specification
    pub url: types::Uri,

    /// Short description
    pub description: Option<types::String>,
}

/// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Are the capabilities required?
    pub required: types::Boolean,

    /// Are the capabilities validated?
    pub validated: types::Boolean,

    /// The expected capabilities of the server
    pub description: Option<types::String>,

    /// Which origin server these requirements apply to
    pub origin: Option<Vec<types::Integer>>,

    /// Which server these requirements apply to
    pub destination: Option<types::Integer>,

    /// Links to the FHIR specification
    pub link: Option<Vec<types::Uri>>,

    /// Required Capability Statement
    pub capabilities: types::Canonical,
}

/// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// The specific conformance artifact being tested
    pub artifact: types::Canonical,

    /// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Whether or not to implicitly create the fixture during setup
    pub autocreate: types::Boolean,

    /// Whether or not to implicitly delete the fixture during teardown
    pub autodelete: types::Boolean,

    /// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Descriptive name for this variable
    pub name: types::String,

    /// Default, hard-coded, or user-defined value for this variable
    pub default_value: Option<types::String>,

    /// Natural language description of the variable
    pub description: Option<types::String>,

    /// The FHIRPath expression against the fixture body
    pub expression: Option<types::String>,

    /// HTTP header field name for source
    pub header_field: Option<types::String>,

    /// Hint help text for default value to enter
    pub hint: Option<types::String>,

    /// XPath or JSONPath against the fixture body
    pub path: Option<types::String>,

    /// Fixture Id of source expression or headerField within this variable
    pub source_id: Option<types::Id>,
}

/// A series of required setup operations before tests are executed.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// A setup operation or assert to perform
    pub action: Vec<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// The operation code type that will be executed
    pub r#type: Option<types::Coding>,

    /// Resource type
    pub resource: Option<types::Uri>,

    /// Tracking/logging operation label
    pub label: Option<types::String>,

    /// Tracking/reporting operation description
    pub description: Option<types::String>,

    /// Mime type to accept in the payload of the response, with charset etc
    pub accept: Option<types::Code>,

    /// Mime type of the request payload contents, with charset etc
    pub content_type: Option<types::Code>,

    /// Server responding to the request
    pub destination: Option<types::Integer>,

    /// Whether or not to send the request url in encoded format
    pub encode_request_url: types::Boolean,

    /// delete | get | options | patch | post | put | head
    pub method: Option<types::Code>,

    /// Server initiating the request
    pub origin: Option<types::Integer>,

    /// Explicitly defined path parameters
    pub params: Option<types::String>,

    /// Each operation can have one or more header elements
    pub request_header: Option<Vec<TestScriptSetupActionOperationRequestHeader>>,

    /// Fixture Id of mapped request
    pub request_id: Option<types::Id>,

    /// Fixture Id of mapped response
    pub response_id: Option<types::Id>,

    /// Fixture Id of body for PUT and POST requests
    pub source_id: Option<types::Id>,

    /// Id of fixture used for extracting the [id],  [type], and [vid] for GET requests
    pub target_id: Option<types::Id>,

    /// Request URL
    pub url: Option<types::String>,
}

/// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// HTTP header field name
    pub field: types::String,

    /// HTTP headerfield value
    pub value: types::String,
}

/// 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Tracking/logging assertion label
    pub label: Option<types::String>,

    /// Tracking/reporting assertion description
    pub description: Option<types::String>,

    /// response | request
    pub direction: Option<types::Code>,

    /// Id of the source fixture to be evaluated
    pub compare_to_source_id: Option<types::String>,

    /// The FHIRPath expression to evaluate against the source fixture
    pub compare_to_source_expression: Option<types::String>,

    /// XPath or JSONPath expression to evaluate against the source fixture
    pub compare_to_source_path: Option<types::String>,

    /// Mime type to compare against the 'Content-Type' header
    pub content_type: Option<types::Code>,

    /// fail | pass | skip | stop
    pub default_manual_completion: Option<types::Code>,

    /// The FHIRPath expression to be evaluated
    pub expression: Option<types::String>,

    /// HTTP header field name
    pub header_field: Option<types::String>,

    /// Fixture Id of minimum content resource
    pub minimum_id: Option<types::String>,

    /// Perform validation on navigation links?
    pub navigation_links: Option<types::Boolean>,

    /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval | manualEval
    pub operator: Option<types::Code>,

    /// XPath or JSONPath expression
    pub path: Option<types::String>,

    /// delete | get | options | patch | post | put | head
    pub request_method: Option<types::Code>,

    /// Request URL comparison value
    pub request_url: Option<types::String>,

    /// Resource type
    pub resource: Option<types::Uri>,

    /// HTTP response status code family
    pub response: Option<types::Code>,

    /// HTTP response code to test
    pub response_code: Option<types::String>,

    /// Fixture Id of source expression or headerField
    pub source_id: Option<types::Id>,

    /// If this assert fails, will the current test execution stop?
    pub stop_test_on_fail: types::Boolean,

    /// Profile Id of validation profile reference
    pub validate_profile_id: Option<types::Id>,

    /// The value to compare to
    pub value: Option<types::String>,

    /// Will this assert produce a warning only on error?
    pub warning_only: types::Boolean,

    /// Links or references to the testing requirements
    pub requirement: Option<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Link or reference to the testing requirement
    pub link_uri: Option<types::Uri>,

    /// Link or reference to the testing requirement
    pub link_canonical: Option<types::Canonical>,
}

/// A test in this script.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// Tracking/logging name of this test
    pub name: Option<types::String>,

    /// Tracking/reporting short description of the test
    pub description: Option<types::String>,

    /// A test operation or assert to perform
    pub action: Vec<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<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, Default, 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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<Vec<types::Extension>>,

    /// One or more teardown operations to perform
    pub action: Vec<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
    pub extension: Option<Vec<types::Extension>>,

    /// Extensions that cannot be ignored even if unrecognized
    pub modifier_extension: Option<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);
    }
}