Expand description
Type checker for the FHIR Mapping Language.
Follows every rule with the types of its variables and reports what cannot work: elements that
do not exist on the type they are read from or written to, a type annotation that is not one of
the element’s types, unknown variables, writes into source variables, unknown or abstract types
in create, transforms with the wrong number of arguments, and calls to groups that are not
declared or take a different number of arguments. It also reports what the Mapping Language IG
requires of a map: a url and a name, groups that extend another with its parameters,
default groups with a typed source and target, and rule names used once.
Groups without parameter types, such as the per-backbone groups of the cross-version maps, are checked with the types they are called with.
use fml_check::{CoreDefinitions, Release, check};
let parse = fml_syntax::parse(r#"
/// url = 'http://example.org/StructureMap/Copy'
/// name = 'Copy'
uses "http://hl7.org/fhir/StructureDefinition/Patient" as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" as target
group Copy(source src : Patient, target tgt : Patient) {
src.nmae -> tgt.name;
}
"#);
let diagnostics = check(&parse.tree(), &CoreDefinitions::new(Release::R5));
assert_eq!(diagnostics[0].message, "`Patient` has no element `nmae`");Re-exports§
pub use definitions::Definitions;pub use definitions::Element;pub use definitions::Kind;pub use definitions::NoDefinitions;pub use definitions::Structure;pub use types::ElementRef;pub use types::Lookup;pub use types::Type;pub use types::Types;
Modules§
- definitions
- The structure definitions a map is checked against.
- types
- Navigating types: the type of a variable, its elements, and the types of those.
Functions§
- check
- Checks a parsed map. Syntax errors are not repeated; see
fml_syntax::Parse::diagnostics.