diff --git a/src/fhirdefs/impliedExtensions.ts b/src/fhirdefs/impliedExtensions.ts index 91b0605f2..daf15b013 100644 --- a/src/fhirdefs/impliedExtensions.ts +++ b/src/fhirdefs/impliedExtensions.ts @@ -334,7 +334,7 @@ function applyToValueXElement( // Handle different representation in DSTU2 and STU3 fromED.binding.valueSet ?? fromED.binding.valueSetUri ?? - fromED.binding.valueSetReference.reference, + fromED.binding.valueSetReference?.reference, fromED.binding.strength ); if (fromED.binding.description) { diff --git a/src/fhirtypes/ElementDefinition.ts b/src/fhirtypes/ElementDefinition.ts index 2fe5afdea..5aeb950da 100644 --- a/src/fhirtypes/ElementDefinition.ts +++ b/src/fhirtypes/ElementDefinition.ts @@ -1677,16 +1677,22 @@ export class ElementDefinition { ) { throw new BindingStrengthError(listElement?.binding?.strength, strength); } - // Canonical URLs may include | to specify version: https://www.hl7.org/fhir/references.html#canonical - if (!isUri(vsURI.split('|')[0])) { - throw new InvalidUriError(vsURI); - } - // We're good. Bind it. - this.binding = { - strength, - valueSet: vsURI - }; + if (vsURI == null) { + // Just bind the strength since valueSet is allowed to be 0..1 + this.binding = { strength }; + } else { + // Canonical URLs may include | to specify version: https://www.hl7.org/fhir/references.html#canonical + if (!isUri(vsURI.split('|')[0])) { + throw new InvalidUriError(vsURI); + } + + // We're good. Bind it. + this.binding = { + strength, + valueSet: vsURI + }; + } } /**