Skip to content

sdc/dependency-cycle ​

warning Reports declarations whose expressions reference each other in a cycle.

What it checks ​

Follows each %name in the expression of a declaration, such as a variable or a named calculatedExpression, and in the {{…}} fragments of its query, to the declaration it resolves to on its item, an ancestor item or the root. Declarations that reach each other through these references form a cycle, directly or through others; a declaration that references itself is one too. Each cycle is reported once, at its first declaration, with the others as related locations.

Example ​

Declarations %a and %b reference each other; updates may not reach a stable value.

fsh
Instance: dependency-cycle-two-variables
InstanceOf: Questionnaire
Usage: #example
* status = #draft
* extension[0].url = "http://hl7.org/fhir/StructureDefinition/variable"
* extension[=].valueExpression.name = "a"
* extension[=].valueExpression.language = #text/fhirpath
* extension[=].valueExpression.expression = "%b + 1"
* extension[+].url = "http://hl7.org/fhir/StructureDefinition/variable"
* extension[=].valueExpression.name = "b"
* extension[=].valueExpression.language = #text/fhirpath
* extension[=].valueExpression.expression = "%a"