Skip to content

Commit

Permalink
Add new test for value sets reference value sets instead of code systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Jan 8, 2025
1 parent b0e9d09 commit 161b1d2
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 9 deletions.
123 changes: 119 additions & 4 deletions validator/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -50508,7 +50508,7 @@
"structuredefinition-version-range.xml"
],
"version": "3.0",
"description": "testing combinations of earliestAllowedFHIRVersion and latestAllowedFHIRVersion",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {
"outcome": {
"resourceType": "OperationOutcome",
Expand All @@ -50535,7 +50535,7 @@
"structuredefinition-version-range.xml"
],
"version": "4.0",
"description": "testing combinations of earliestAllowedFHIRVersion and latestAllowedFHIRVersion",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {}
},
{
Expand All @@ -50545,7 +50545,7 @@
"structuredefinition-version-range.xml"
],
"version": "4.3",
"description": "testing combinations of earliestAllowedFHIRVersion and latestAllowedFHIRVersion",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {}
},
{
Expand All @@ -50555,7 +50555,7 @@
"structuredefinition-version-range.xml"
],
"version": "5.0",
"description": "testing combinations of earliestAllowedFHIRVersion and latestAllowedFHIRVersion",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {
"outcome": {
"resourceType": "OperationOutcome",
Expand All @@ -50575,6 +50575,121 @@
}
}
},
{
"name": "extension-version-restriction-range-ctxt-r3",
"file": "patient-version-range.json",
"supporting5": [
"structuredefinition-version-range-ctxt.xml"
],
"version": "3.0",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {
"outcome": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "structure",
"details": {
"text": "The extension http://hl7.org/fhir/test/StructureDefinition/version-range is not allowed to be used at this point (allowed for this version = e:CodeSystem.property; this element is [Patient])"
},
"diagnostics": "[1,2]",
"expression": [
"Patient"
]
}
]
}
}
},
{
"name": "extension-version-restriction-range-ctxt-r4",
"file": "patient-version-range.json",
"supporting5": [
"structuredefinition-version-range-ctxt.xml"
],
"version": "4.0",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {}
},
{
"name": "extension-version-restriction-range-ctxt-r4b",
"file": "patient-version-range.json",
"supporting5": [
"structuredefinition-version-range-ctxt.xml"
],
"version": "4.3",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {}
},
{
"name": "extension-version-restriction-range-ctxt-r5",
"file": "patient-version-range.json",
"supporting5": [
"structuredefinition-version-range-ctxt.xml"
],
"version": "5.0",
"description": "testing usage of http://hl7.org/fhir/StructureDefinition/version-specific-use",
"java": {
"outcome": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "structure",
"details": {
"text": "The extension http://hl7.org/fhir/test/StructureDefinition/version-range is not allowed to be used at this point (allowed for this version = e:CodeSystem.property; this element is [Patient])"
},
"diagnostics": "[1,2]",
"expression": [
"Patient"
]
}
]
}
}
},
{
"name": "vs-wrong-vs",
"file": "vs-wrong-vs.xml",
"version": "5.0",
"description": "it's an actual error if the value set tries to use a value set url as the code system - check that",
"java": {
"outcome": {
"resourceType": "OperationOutcome",
"issue": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-server",
"valueUrl": "http://tx-dev.fhir.org/r4"
}
],
"severity": "information",
"code": "business-rule",
"details": {
"text": "Reference to deprecated ValueSet http://hl7.org/fhir/ValueSet/jurisdiction|5.0.0"
},
"diagnostics": "[23,17]",
"expression": [
"ValueSet.jurisdiction[0]"
]
},
{
"severity": "error",
"code": "invalid",
"details": {
"text": "The system 'http://hl7.org/fhir/ValueSet/FHIR-version' is actually a value set, which itself refers to the system 'http://hl7.org/fhir/FHIR-version' so that may be what is intended here"
},
"diagnostics": "[31,14]",
"expression": [
"ValueSet.compose.include[0]"
]
}
]
}
}
},
{
"name": "zzz",
"file": "zzz.json",
Expand Down
62 changes: 62 additions & 0 deletions validator/structuredefinition-version-range-ctxt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../input-cache/schemas/R4/fhir-single.xsd">
<id value="version-range"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/version-range"/>
<name value="VersionRangeExtension"/>
<title value="Version Range Extension"/>
<status value="active"/>
<experimental value="false"/>
<publisher value="HL7 International / FHIR Infrastructure"/>
<contact>
<telecom>
<!-- Or whatever URL and/or email address(es) are appropriate -->
<system value="url"/>
<value value="http://hl7.org/Special/committees/fhir-i"/>
</telecom>
</contact>
<description value="Allowed R3-R4"/>
<fhirVersion value="4.0.1"/>
<kind value="complex-type"/>
<abstract value="false"/>
<context>
<extension url="http://hl7.org/fhir/StructureDefinition/version-specific-use">
<extension url="startFhirVersion">
<valueCode value="4.0"/>
</extension>
<extension url="endFhirVersion">
<valueCode value="4.3"/>
</extension>
</extension>
<type value="element"/>
<expression value="Patient"/>
</context>
<context>
<type value="element"/>
<expression value="CodeSystem.property"/>
</context>
<type value="Extension"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/>
<derivation value="constraint"/>
<differential>
<element id="Extension">
<path value="Extension"/>
<short value="Additional Binding"/>
<definition value="Additional bindings applied to bindable elements."/>
<min value="0"/>
<max value="*"/>
</element>

<element id="Extension.url">
<path value="Extension.url"/>
<fixedUri value="http://hl7.org/fhir/test/StructureDefinition/version-range"/>
</element>
<element id="Extension.value[x]">
<path value="Extension.value[x]"/>
<min value="1"/>
<max value="1"/>
<type>
<code value="code"/>
</type>
</element>
</differential>
</StructureDefinition>
12 changes: 7 additions & 5 deletions validator/structuredefinition-version-range.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../input-cache/schemas/R4/fhir-single.xsd">
<id value="version-range"/>
<extension url="http://hl7.org/fhir/StructureDefinition/earliestAllowedFHIRVersion">
<valueCode value="4.0"/>
</extension>
<extension url="http://hl7.org/fhir/StructureDefinition/latestAllowedFHIRVersion">
<valueCode value="4.3"/>
<extension url="http://hl7.org/fhir/StructureDefinition/version-specific-use">
<extension url="startFhirVersion">
<valueCode value="4.0"/>
</extension>
<extension url="endFhirVersion">
<valueCode value="4.3"/>
</extension>
</extension>
<url value="http://hl7.org/fhir/test/StructureDefinition/version-range"/>
<name value="VersionRangeExtension"/>
Expand Down
51 changes: 51 additions & 0 deletions validator/vs-wrong-vs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>

<ValueSet xmlns="http://hl7.org/fhir">
<id value="major-fhir-version"/>
<url value="http://hl7.org/fhir/ValueSet/major-fhir-version"/>
<identifier>
<system value="urn:ietf:rfc:3986"/>
<value value="urn:oid:2.16.840.1.113883.4.642.3.3330"/>
</identifier>
<version value="5.0.0"/>
<name value="MajorFHIRVersions"/>
<title value="Major FHIR Versions"/>
<status value="active"/>
<experimental value="false"/>
<publisher value="HL7 International / FHIR Infrastructure"/>
<contact>
<telecom>
<system value="url"/>
<value value="http://www.hl7.org/Special/committees/fiwg"/>
</telecom>
</contact>
<description value="The milestone releases of FHIR versions, identified by their major.minor versions (no patch versions)"/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<compose>
<include>
<system value="http://hl7.org/fhir/ValueSet/FHIR-version"/>
<version value="5.0.0"/>
<concept>
<code value="1.0"/>
</concept>
<concept>
<code value="3.0"/>
</concept>
<concept>
<code value="4.0"/>
</concept>
<concept>
<code value="4.3"/>
</concept>
<concept>
<code value="5.0"/>
</concept>
</include>
</compose>
</ValueSet>

0 comments on commit 161b1d2

Please sign in to comment.