Skip to content

Commit

Permalink
Merge branch 'master' into url-encode-brackets-2
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoesel authored Dec 23, 2024
2 parents bc41246 + 786eb03 commit fdcce94
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/export/ValueSetExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,15 @@ export class ValueSetExporter {
});
}
}

if (conceptIndex == null) {
logger.error(
`Cannot process caret assignment rule for code ${system}#${code} because ` +
'this value set does not explicitly include or exclude this code in its ' +
'rules. To fix this error, add a rule that specifically includes or excludes ' +
'this code for the value set.'
);
return;
}
if (conceptIndex !== -1) {
if (rule.isInstance) {
const instanceExporter = new InstanceExporter(this.tank, this.pkg, this.fisher);
Expand Down
28 changes: 28 additions & 0 deletions test/export/ValueSetExporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,34 @@ describe('ValueSetExporter', () => {
});
});

it('should throw error for caret rule on valueset compose component without any concept', () => {
// ValueSet: SomeVS
// * include codes from system http://example.org/CS
// * http://example.org/CS#"some-code" ^designation.value = "some value"

const valueSet = new FshValueSet('SomeVS');

const component = new ValueSetConceptComponentRule(true);
component.from.system = 'http://example.org/CS';

const cvRule = new CaretValueRule('');
cvRule.pathArray = ['http://example.org/CS#"some-code"'];
cvRule.caretPath = 'designation.value';
cvRule.value = 'some value';

valueSet.rules.push(component, cvRule);
doc.valueSets.set(valueSet.name, valueSet);
const exported = exporter.export().valueSets;
expect(exported.length).toBe(1);
expect(loggerSpy.getAllMessages('error')).toHaveLength(1);
expect(loggerSpy.getLastMessage('error')).toBe(
'Cannot process caret assignment rule for code http://example.org/CS#"some-code" ' +
'because this value set does not explicitly include or exclude this code in its ' +
'rules. To fix this error, add a rule that specifically includes or excludes this ' +
'code for the value set.'
);
});

it('should export a value set with a contained resource created on the value set', () => {
// ValueSet: DinnerVS
// * ^contained.resourceType = "Observation"
Expand Down

0 comments on commit fdcce94

Please sign in to comment.